/******************************************
* AChance AutoProgrammer    2020.02.26 14:10:17
* 系统名称: FundwareWeb  房易维
******************************************/

/******************************************
FDWORG   系统机构表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWORG]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWORG];
CREATE TABLE [dbo].[FDWORG] (
    ORGID VARCHAR (32)  NOT NULL,
    ORGNAME VARCHAR (64)  NOT NULL,
    ORGTYPE VARCHAR (1)  NOT NULL,
    ORGADDR VARCHAR (100)  NOT NULL,
    ORGZIPCODE VARCHAR (6)  NOT NULL,
    ORGCONSULTPHONE VARCHAR (100)  NOT NULL
);

ALTER TABLE FDWORG ADD
    CONSTRAINT PK_FDWORG PRIMARY KEY
    (
        ORGID
    );

/******************************************
FDWPRO   系统项目表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPRO]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPRO];
CREATE TABLE [dbo].[FDWPRO] (
    PROORGID VARCHAR (32)  NOT NULL,
    PROID VARCHAR (50)  NOT NULL,
    PRONAME VARCHAR (50)  NOT NULL
);

ALTER TABLE FDWPRO ADD
    CONSTRAINT PK_FDWPRO PRIMARY KEY
    (
        PROORGID,
        PROID
    );

/******************************************
FDWPRU   系统项目客户表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPRU]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPRU];
CREATE TABLE [dbo].[FDWPRU] (
    PRUORGID VARCHAR (32)  NOT NULL,
    PRUPROID VARCHAR (50)  NOT NULL,
    PRUID VARCHAR (50)  NOT NULL,
    PRUNAME VARCHAR (50)  NOT NULL,
    PRUONLINE VARCHAR (1)  NOT NULL,
    PRUISSPECIAL VARCHAR (1)  NOT NULL,
    PRUNUM INT  NOT NULL
);

ALTER TABLE FDWPRU ADD
    CONSTRAINT PK_FDWPRU PRIMARY KEY
    (
        PRUORGID,
        PRUPROID,
        PRUID
    );

/******************************************
FDWFGP   系统功能分组表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWFGP]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWFGP];
CREATE TABLE [dbo].[FDWFGP] (
    FGPORGID VARCHAR (32)  NOT NULL,
    FGPPROID VARCHAR (50)  NOT NULL,
    FGPPRUID VARCHAR (50)  NOT NULL,
    FGPID VARCHAR (32)  NOT NULL,
    FGPNAME VARCHAR (32)  NOT NULL,
    FGPIMAGEURL VARCHAR (100)  NOT NULL,
    FGPNUM INT  NOT NULL
);

ALTER TABLE FDWFGP ADD
    CONSTRAINT PK_FDWFGP PRIMARY KEY
    (
        FGPORGID,
        FGPPROID,
        FGPPRUID,
        FGPID
    );

/******************************************
FDWFUN   系统功能模块表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWFUN]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWFUN];
CREATE TABLE [dbo].[FDWFUN] (
    FUNORGID VARCHAR (32)  NOT NULL,
    FUNPROID VARCHAR (50)  NOT NULL,
    FUNPRUID VARCHAR (50)  NOT NULL,
    FUNFGPID VARCHAR (32)  NOT NULL,
    FUNID VARCHAR (32)  NOT NULL,
    FUNNAME VARCHAR (32)  NOT NULL,
    FUNURL VARCHAR (100)  NOT NULL,
    FUNNUM INT  NOT NULL
);

ALTER TABLE FDWFUN ADD
    CONSTRAINT PK_FDWFUN PRIMARY KEY
    (
        FUNORGID,
        FUNPROID,
        FUNPRUID,
        FUNFGPID,
        FUNID
    );

/******************************************
FDWBTN   系统功能明细表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWBTN]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWBTN];
CREATE TABLE [dbo].[FDWBTN] (
    BTNORGID VARCHAR (32)  NOT NULL,
    BTNPROID VARCHAR (50)  NOT NULL,
    BTNPRUID VARCHAR (50)  NOT NULL,
    BTNFGPID VARCHAR (32)  NOT NULL,
    BTNFUNID VARCHAR (32)  NOT NULL,
    BTNPROCESS VARCHAR (50)  NOT NULL,
    BTNID VARCHAR (32)  NOT NULL,
    BTNNAME VARCHAR (32)  NOT NULL,
    BTNSHOWNAME VARCHAR (32)  NOT NULL,
    BTNSIGN VARCHAR (50)  NOT NULL,
    BTNNUM INT  NOT NULL
);

ALTER TABLE FDWBTN ADD
    CONSTRAINT PK_FDWBTN PRIMARY KEY
    (
        BTNORGID,
        BTNPROID,
        BTNPRUID,
        BTNFGPID,
        BTNFUNID,
        BTNPROCESS,
        BTNID
    );

/******************************************
FDWDLI   系统列表显示类型表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWDLI]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWDLI];
CREATE TABLE [dbo].[FDWDLI] (
    DLIORGID VARCHAR (32)  NOT NULL,
    DLIPROID VARCHAR (50)  NOT NULL,
    DLIPRUID VARCHAR (50)  NOT NULL,
    DLIFUNID VARCHAR (32)  NOT NULL,
    DLIID VARCHAR (50)  NOT NULL,
    DLINAME VARCHAR (50)  NOT NULL,
    DLITYPE VARCHAR (1)  NOT NULL,
    DLINUM INT  NOT NULL
);

ALTER TABLE FDWDLI ADD
    CONSTRAINT PK_FDWDLI PRIMARY KEY
    (
        DLIORGID,
        DLIPROID,
        DLIPRUID,
        DLIFUNID,
        DLIID
    );

/******************************************
FDWDLX   系统列表显示列项表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWDLX]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWDLX];
CREATE TABLE [dbo].[FDWDLX] (
    DLXORGID VARCHAR (32)  NOT NULL,
    DLXPROID VARCHAR (50)  NOT NULL,
    DLXPRUID VARCHAR (50)  NOT NULL,
    DLXFUNID VARCHAR (32)  NOT NULL,
    DLXDLIID VARCHAR (50)  NOT NULL,
    DLXID VARCHAR (50)  NOT NULL,
    DLXNAME VARCHAR (50)  NOT NULL,
    DLXALIAS VARCHAR (50)  NOT NULL,
    DLXTYPE VARCHAR (50)  NOT NULL,
    DLXFORMAT VARCHAR (100)  NOT NULL,
    DLXALIGN VARCHAR (50)  NOT NULL,
    DLXSORT VARCHAR (100)  NOT NULL,
    DLXWIDTH INT  NOT NULL,
    DLXOTHER VARCHAR (200)  NOT NULL,
    DLXSTATUS VARCHAR (1)  NOT NULL,
    DLXNUM DECIMAL (9, 2)  NOT NULL
);

ALTER TABLE FDWDLX ADD
    CONSTRAINT PK_FDWDLX PRIMARY KEY
    (
        DLXORGID,
        DLXPROID,
        DLXPRUID,
        DLXFUNID,
        DLXDLIID,
        DLXID
    );

/******************************************
FDWCTP   系统编码模块表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWCTP]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWCTP];
CREATE TABLE [dbo].[FDWCTP] (
    CTPORGID VARCHAR (32)  NOT NULL,
    CTPID VARCHAR (32)  NOT NULL,
    CTPNAME VARCHAR (32)  NOT NULL,
    CTPTYPE VARCHAR (1)  NOT NULL,
    CTPUSETYPE VARCHAR (1)  NOT NULL,
    CTPSTATUS VARCHAR (1)  NOT NULL,
    CTPNUM INT  NOT NULL
);

ALTER TABLE FDWCTP ADD
    CONSTRAINT PK_FDWCTP PRIMARY KEY
    (
        CTPORGID,
        CTPID
    );

/******************************************
FDWCOD   系统编码明细表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWCOD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWCOD];
CREATE TABLE [dbo].[FDWCOD] (
    CODORGID VARCHAR (32)  NOT NULL,
    CODCTPID VARCHAR (32)  NOT NULL,
    CODNAME VARCHAR (100)  NOT NULL,
    CODALIAS VARCHAR (60)  NOT NULL,
    CODTYPE VARCHAR (1)  NOT NULL,
    CODDESC VARCHAR (200)  NOT NULL,
    CODSTATUS VARCHAR (1)  NOT NULL,
    CODNUM INT  NOT NULL
);

ALTER TABLE FDWCOD ADD
    CONSTRAINT PK_FDWCOD PRIMARY KEY
    (
        CODORGID,
        CODCTPID,
        CODNAME
    );

/******************************************
FDWPVL   系统参数表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPVL]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPVL];
CREATE TABLE [dbo].[FDWPVL] (
    PVLORGID VARCHAR (32)  NOT NULL,
    PVLID VARCHAR (100)  NOT NULL,
    PVLVALUE VARCHAR (100)  NOT NULL,
    PVLTYPE VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWPVL ADD
    CONSTRAINT PK_FDWPVL PRIMARY KEY
    (
        PVLORGID,
        PVLID
    );

/******************************************
FDWDPT   系统部门表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWDPT]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWDPT];
CREATE TABLE [dbo].[FDWDPT] (
    DPTID VARCHAR (32)  NOT NULL,
    DPTNAME VARCHAR (32)  NOT NULL,
    DPTNO VARCHAR (32)  NOT NULL,
    DPTTEL VARCHAR (64)  NOT NULL,
    DPTPSN VARCHAR (32)  NOT NULL,
    DPTSTATUS VARCHAR (1)  NOT NULL,
    DPTNUM INT  NOT NULL
);

ALTER TABLE FDWDPT ADD
    CONSTRAINT PK_FDWDPT PRIMARY KEY
    (
        DPTID
    );

/******************************************
FDWROL   系统角色表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWROL]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWROL];
CREATE TABLE [dbo].[FDWROL] (
    ROLID VARCHAR (32)  NOT NULL,
    ROLDPTID VARCHAR (32)  NOT NULL,
    ROLNAME VARCHAR (32)  NOT NULL,
    ROLDESC VARCHAR (64)  NOT NULL,
    ROLSTATUS VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWROL ADD
    CONSTRAINT PK_FDWROL PRIMARY KEY
    (
        ROLID
    );

/******************************************
FDWRAC   系统角色功能明细表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWRAC]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWRAC];
CREATE TABLE [dbo].[FDWRAC] (
    RACROLID VARCHAR (32)  NOT NULL,
    RACFUNID VARCHAR (32)  NOT NULL,
    RACBTNID VARCHAR (32)  NOT NULL
);

ALTER TABLE FDWRAC ADD
    CONSTRAINT PK_FDWRAC PRIMARY KEY
    (
        RACROLID,
        RACFUNID,
        RACBTNID
    );

/******************************************
FDWUSR   系统用户表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWUSR]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWUSR];
CREATE TABLE [dbo].[FDWUSR] (
    USRID VARCHAR (32)  NOT NULL,
    USRDPTID VARCHAR (32)  NOT NULL,
    USRLOGINNAME VARCHAR (32)  NOT NULL,
    USRPASSWD VARCHAR (100)  NOT NULL,
    USRNAME VARCHAR (32)  NOT NULL,
    USRTEL VARCHAR (64)  NOT NULL,
    USRPHONE VARCHAR (11)  NOT NULL,
    USRSTATUS VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWUSR ADD
    CONSTRAINT PK_FDWUSR PRIMARY KEY
    (
        USRID
    );

/******************************************
FDWOUR   其他类型用户表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWOUR]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWOUR];
CREATE TABLE [dbo].[FDWOUR] (
    OURID VARCHAR (32)  NOT NULL,
    OURMBDTYPE VARCHAR (16)  NOT NULL,
    OURMBDID VARCHAR (32)  NOT NULL,
    OURLOGINNAME VARCHAR (32)  NOT NULL,
    OURPASSWD VARCHAR (100)  NOT NULL,
    OURNAME VARCHAR (100)  NOT NULL,
    OURTEL VARCHAR (64)  NOT NULL,
    OURPHONE VARCHAR (11)  NOT NULL,
    OURSTATUS VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWOUR ADD
    CONSTRAINT PK_FDWOUR PRIMARY KEY
    (
        OURID
    );

/******************************************
FDWACS   系统用户角色表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWACS]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWACS];
CREATE TABLE [dbo].[FDWACS] (
    ACSUSRID VARCHAR (32)  NOT NULL,
    ACSROLID VARCHAR (32)  NOT NULL
);

ALTER TABLE FDWACS ADD
    CONSTRAINT PK_FDWACS PRIMARY KEY
    (
        ACSUSRID,
        ACSROLID
    );

/******************************************
FDWXLS   系统电子表格配置表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWXLS]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWXLS];
CREATE TABLE [dbo].[FDWXLS] (
    XLSORGID VARCHAR (32)  NOT NULL,
    XLSID VARCHAR (50)  NOT NULL,
    XLSBLKID VARCHAR (50)  NOT NULL,
    XLSFLDID VARCHAR (50)  NOT NULL,
    XLSFLDNAME VARCHAR (100)  NOT NULL,
    XLSFLDCONFIG VARCHAR (1000)  NOT NULL,
    XLSNUM INT  NOT NULL
);

ALTER TABLE FDWXLS ADD
    CONSTRAINT PK_FDWXLS PRIMARY KEY
    (
        XLSORGID,
        XLSID,
        XLSBLKID,
        XLSFLDID
    );

/******************************************
FDWRAT   系统利率表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWRAT]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWRAT];
CREATE TABLE [dbo].[FDWRAT] (
    RATTYPE INT  NOT NULL,
    RATRATE DECIMAL (9, 4)  NOT NULL,
    RATBEGDATE VARCHAR (8)  NOT NULL,
    RATDESC VARCHAR (200)  NOT NULL
);

ALTER TABLE FDWRAT ADD
    CONSTRAINT PK_FDWRAT PRIMARY KEY
    (
        RATTYPE,
        RATBEGDATE
    );

/******************************************
FDWYYY   系统业务流程表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWYYY]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWYYY];
CREATE TABLE [dbo].[FDWYYY] (
    YYYORGID VARCHAR (32)  NOT NULL,
    YYYPROID VARCHAR (50)  NOT NULL,
    YYYFIELD VARCHAR (50)  NOT NULL,
    YYYNAME VARCHAR (64)  NOT NULL,
    YYYNUM INT  NOT NULL
);

ALTER TABLE FDWYYY ADD
    CONSTRAINT PK_FDWYYY PRIMARY KEY
    (
        YYYORGID,
        YYYPROID,
        YYYFIELD
    );

/******************************************
FDWYTY   系统业务状态配置表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWYTY]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWYTY];
CREATE TABLE [dbo].[FDWYTY] (
    YTYORGID VARCHAR (32)  NOT NULL,
    YTYPROID VARCHAR (50)  NOT NULL,
    YTYPRUID VARCHAR (50)  NOT NULL,
    YTYFIELD VARCHAR (50)  NOT NULL,
    YTYSTATUS VARCHAR (1)  NOT NULL,
    YTYORIMBDTYPE VARCHAR (60)  NOT NULL,
    YTYDESC VARCHAR (50)  NOT NULL,
    YTYFILTERDESC VARCHAR (50)  NOT NULL,
    YTYNEXTMODE VARCHAR (1)  NOT NULL,
    YTYNEXTDESC VARCHAR (50)  NOT NULL,
    YTYBTNID VARCHAR (32)  NOT NULL,
    YTYTITLE VARCHAR (300)  NOT NULL,
    YTYAUTSIGN VARCHAR (1)  NOT NULL,
    YTYNUM INT  NOT NULL
);

ALTER TABLE FDWYTY ADD
    CONSTRAINT PK_FDWYTY PRIMARY KEY
    (
        YTYORGID,
        YTYPROID,
        YTYPRUID,
        YTYFIELD,
        YTYSTATUS,
        YTYORIMBDTYPE
    );

/******************************************
FDWYPD   系统业务流程配置表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWYPD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWYPD];
CREATE TABLE [dbo].[FDWYPD] (
    YPDORGID VARCHAR (32)  NOT NULL,
    YPDPROID VARCHAR (50)  NOT NULL,
    YPDFIELD VARCHAR (50)  NOT NULL,
    YPDSIGN VARCHAR (1)  NOT NULL,
    YPDFROMSTATUS VARCHAR (1)  NOT NULL,
    YPDTOSTATUS VARCHAR (1)  NOT NULL,
    YPDHISDESC VARCHAR (100)  NOT NULL
);

ALTER TABLE FDWYPD ADD
    CONSTRAINT PK_FDWYPD PRIMARY KEY
    (
        YPDORGID,
        YPDPROID,
        YPDFIELD,
        YPDFROMSTATUS,
        YPDTOSTATUS
    );

/******************************************
FDWYPS   系统业务承诺日期配置表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWYPS]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWYPS];
CREATE TABLE [dbo].[FDWYPS] (
    YPSORGID VARCHAR (32)  NOT NULL,
    YPSPROID VARCHAR (50)  NOT NULL,
    YPSPRUID VARCHAR (50)  NOT NULL,
    YPSYYYFIELD VARCHAR (50)  NOT NULL,
    YPSSTATUS VARCHAR (32)  NOT NULL,
    YPSTYPE VARCHAR (1)  NOT NULL,
    YPSDESC VARCHAR (50)  NOT NULL,
    YPSDATE INT  NOT NULL,
    YPSNUM INT  NOT NULL
);

ALTER TABLE FDWYPS ADD
    CONSTRAINT PK_FDWYPS PRIMARY KEY
    (
        YPSORGID,
        YPSPROID,
        YPSPRUID,
        YPSYYYFIELD,
        YPSSTATUS,
        YPSTYPE
    );

/******************************************
FDWYHS   系统业务操作历史表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWYHS]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWYHS];
CREATE TABLE [dbo].[FDWYHS] (
    YHSID VARCHAR (32)  NOT NULL,
    YHSMBDID VARCHAR (32)  NOT NULL,
    YHSFROMSTATUS VARCHAR (10)  NOT NULL,
    YHSSIGN VARCHAR (1)  NOT NULL,
    YHSSTATUS VARCHAR (10)  NOT NULL,
    YHSDESC VARCHAR (50)  NOT NULL,
    YHSUSER VARCHAR (50)  NOT NULL,
    YHSCOMPANY VARCHAR (100)  NOT NULL,
    YHSDATE VARCHAR (8)  NOT NULL,
    YHSTIME VARCHAR (6)  NOT NULL,
    YHSCOMMENT VARCHAR (2000)  NOT NULL
);

ALTER TABLE FDWYHS ADD
    CONSTRAINT PK_FDWYHS PRIMARY KEY
    (
        YHSID
    );

/******************************************
FDWYAS   系统业务审批表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWYAS]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWYAS];
CREATE TABLE [dbo].[FDWYAS] (
    YASID VARCHAR (32)  NOT NULL,
    YASMBDID VARCHAR (32)  NOT NULL,
    YASSTATUS VARCHAR (10)  NOT NULL,
    YASDESC VARCHAR (50)  NOT NULL,
    YASUSER VARCHAR (50)  NOT NULL,
    YASCOMPANY VARCHAR (100)  NOT NULL,
    YASDATE VARCHAR (8)  NOT NULL,
    YASTIME VARCHAR (6)  NOT NULL,
    YASCOMMENT VARCHAR (1000)  NOT NULL,
    YASSGIN VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWYAS ADD
    CONSTRAINT PK_FDWYAS PRIMARY KEY
    (
        YASID
    );

/******************************************
FDWYBW   系统业务备忘录
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWYBW]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWYBW];
CREATE TABLE [dbo].[FDWYBW] (
    YBWID VARCHAR (32)  NOT NULL,
    YBWMBDID VARCHAR (32)  NOT NULL,
    YBWCONTENT TEXT  NOT NULL,
    YBWDATE VARCHAR (8)  NOT NULL,
    YBWTIME VARCHAR (6)  NOT NULL
);

ALTER TABLE FDWYBW ADD
    CONSTRAINT PK_FDWYBW PRIMARY KEY
    (
        YBWID
    );

/******************************************
FDWHOL   系统节假日表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWHOL]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWHOL];
CREATE TABLE [dbo].[FDWHOL] (
    HOLID VARCHAR (32)  NOT NULL,
    HOLSTRDATE VARCHAR (8)  NOT NULL,
    HOLENDDATE VARCHAR (8)  NOT NULL,
    HOLTYPE VARCHAR (1)  NOT NULL,
    HOLREMARK VARCHAR (100)  NOT NULL
);

ALTER TABLE FDWHOL ADD
    CONSTRAINT PK_FDWHOL PRIMARY KEY
    (
        HOLID
    );

/******************************************
FDWATK   系统资金类型表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWATK]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWATK];
CREATE TABLE [dbo].[FDWATK] (
    ATKORGID VARCHAR (32)  NOT NULL,
    ATKKIND VARCHAR (32)  NOT NULL,
    ATKNAME VARCHAR (64)  NOT NULL,
    ATKNUM INT  NOT NULL,
    ATKISACC VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWATK ADD
    CONSTRAINT PK_FDWATK PRIMARY KEY
    (
        ATKORGID,
        ATKKIND
    );

/******************************************
FDWASR   系统资金类型物业关系表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWASR]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWASR];
CREATE TABLE [dbo].[FDWASR] (
    ASRORGID VARCHAR (32)  NOT NULL,
    ASRATKKIND VARCHAR (32)  NOT NULL,
    ASRCODE VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWASR ADD
    CONSTRAINT PK_FDWASR PRIMARY KEY
    (
        ASRORGID,
        ASRATKKIND
    );

/******************************************
FDWSYS   系统状态或升级表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSYS]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSYS];
CREATE TABLE [dbo].[FDWSYS] (
    SYSID VARCHAR (32)  NOT NULL,
    SYSNEWDATE VARCHAR (8)  NOT NULL,
    SYSMODDATE VARCHAR (8)  NOT NULL,
    SYSDATAVER INT  NOT NULL
);

ALTER TABLE FDWSYS ADD
    CONSTRAINT PK_FDWSYS PRIMARY KEY
    (
        SYSID
    );

/******************************************
FDWUPD   数据库自动更新表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWUPD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWUPD];
CREATE TABLE [dbo].[FDWUPD] (
    UPDNAME VARCHAR (64)  NOT NULL,
    UPDVERSION INT  NOT NULL
);

ALTER TABLE FDWUPD ADD
    CONSTRAINT PK_FDWUPD PRIMARY KEY
    (
        UPDNAME
    );

/******************************************
FDWBIP   银行接口参数表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWBIP]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWBIP];
CREATE TABLE [dbo].[FDWBIP] (
    BIPID VARCHAR (32)  NOT NULL,
    BIPBNKID VARCHAR (32)  NOT NULL,
    BIPBCIP VARCHAR (32)  NOT NULL,
    BIPBSIP VARCHAR (32)  NOT NULL,
    BIPBSPORT VARCHAR (32)  NOT NULL
);

ALTER TABLE FDWBIP ADD
    CONSTRAINT PK_FDWBIP PRIMARY KEY
    (
        BIPID
    );

/******************************************
FDWBDS   银行接口发送表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWBDS]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWBDS];
CREATE TABLE [dbo].[FDWBDS] (
    BDSID VARCHAR (32)  NOT NULL,
    BDSBIPID VARCHAR (32)  NOT NULL,
    BDSDATATYPE VARCHAR (2)  NOT NULL,
    BDSCREATEDATE VARCHAR (8)  NOT NULL,
    BDSCREATETIME VARCHAR (6)  NOT NULL,
    BDSSTREAMID VARCHAR (50)  NOT NULL,
    BDSTYPE VARCHAR (50)  NOT NULL,
    BDSOPERATE VARCHAR (1)  NOT NULL,
    BDSBNKID VARCHAR (32)  NOT NULL,
    BDSSTATUS VARCHAR (1)  NOT NULL,
    BDSSENDDATE VARCHAR (8)  NOT NULL,
    BDSSENDTIME VARCHAR (6)  NOT NULL,
    BDSSENDLOG VARCHAR (1024)  NOT NULL,
    BDSPKGSND VARCHAR (1024)  NOT NULL,
    BDSPKGRCV VARCHAR (1024)  NOT NULL,
    BDSRET VARCHAR (4)  NOT NULL,
    BDSUSRCREATE VARCHAR (20)  NOT NULL,
    BDSBCLPKG VARCHAR (1024)  NOT NULL,
    BDSBCLRCVDATE VARCHAR (8)  NOT NULL,
    BDSBCLRCVTIME VARCHAR (6)  NOT NULL,
    BDSBCLSTATUS VARCHAR (1)  NOT NULL,
    BDSBCLDESC VARCHAR (1024)  NOT NULL,
    BDSBCLBUSI VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWBDS ADD
    CONSTRAINT PK_FDWBDS PRIMARY KEY
    (
        BDSID
    );

/******************************************
FDWBIR   银行接口接收表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWBIR]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWBIR];
CREATE TABLE [dbo].[FDWBIR] (
    BIRID VARCHAR (32)  NOT NULL,
    BIRBIPID VARCHAR (32)  NOT NULL,
    BIRINOUT VARCHAR (1)  NOT NULL,
    BIRTRDDATE VARCHAR (8)  NOT NULL,
    BIRSTREAMID VARCHAR (100)  NOT NULL,
    BIRTYPE VARCHAR (100)  NOT NULL,
    BIRBNKID VARCHAR (32)  NOT NULL,
    BIRRCVDATE VARCHAR (8)  NOT NULL,
    BIRRCVTIME VARCHAR (6)  NOT NULL,
    BIRUNIT VARCHAR (100)  NOT NULL,
    BIRPRNAME VARCHAR (100)  NOT NULL,
    BIRMONEY DECIMAL (15, 2)  NOT NULL,
    BIRBNKNAME VARCHAR (100)  NOT NULL,
    BIRBNKNO VARCHAR (100)  NOT NULL,
    BIRACTNAME VARCHAR (100)  NOT NULL,
    BIRACCOUNT VARCHAR (100)  NOT NULL,
    BIRPURPOSE VARCHAR (200)  NOT NULL,
    BIRBNKUSR VARCHAR (50)  NOT NULL,
    BIRDOCNO VARCHAR (50)  NOT NULL,
    BIRSTATUS VARCHAR (1)  NOT NULL,
    BIRCHKDATE VARCHAR (8)  NOT NULL,
    BIRCHKTIME VARCHAR (6)  NOT NULL,
    BIRCOMPANY VARCHAR (100)  NOT NULL,
    BIRCHKUSR VARCHAR (50)  NOT NULL
);

ALTER TABLE FDWBIR ADD
    CONSTRAINT PK_FDWBIR PRIMARY KEY
    (
        BIRID
    );

/******************************************
FDWBIT   银行接口接收对账表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWBIT]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWBIT];
CREATE TABLE [dbo].[FDWBIT] (
    BITID VARCHAR (32)  NOT NULL,
    BITBIPID VARCHAR (32)  NOT NULL,
    BITTRDDATE VARCHAR (8)  NOT NULL,
    BITBNKID VARCHAR (32)  NOT NULL,
    BITRCVDATE VARCHAR (8)  NOT NULL,
    BITRCVTIME VARCHAR (6)  NOT NULL,
    BITBNKNAME VARCHAR (100)  NOT NULL,
    BITBNKNO VARCHAR (100)  NOT NULL,
    BITACTNAME VARCHAR (100)  NOT NULL,
    BITACCOUNT VARCHAR (100)  NOT NULL,
    BITBEGBALANCE DECIMAL (15, 2)  NOT NULL,
    BITENDBALANCE DECIMAL (15, 2)  NOT NULL,
    BITINNUM INT  NOT NULL,
    BITINMONEY DECIMAL (15, 2)  NOT NULL,
    BITOUTNUM INT  NOT NULL,
    BITOUTMONEY DECIMAL (15, 2)  NOT NULL,
    BITSTATUS VARCHAR (1)  NOT NULL,
    BITCHKDATE VARCHAR (8)  NOT NULL,
    BITCHKTIME VARCHAR (6)  NOT NULL,
    BITCOMPANY VARCHAR (100)  NOT NULL,
    BITCHKUSR VARCHAR (50)  NOT NULL
);

ALTER TABLE FDWBIT ADD
    CONSTRAINT PK_FDWBIT PRIMARY KEY
    (
        BITID
    );

/******************************************
FDWLHO   系统流水勾对表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWLHO]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWLHO];
CREATE TABLE [dbo].[FDWLHO] (
    LHOID VARCHAR (32)  NOT NULL,
    LHOMBDNAME VARCHAR (100)  NOT NULL,
    LHOOPPMBDTYPE VARCHAR (32)  NOT NULL,
    LHOOPPMBDID VARCHAR (32)  NOT NULL,
    LHOINOUT VARCHAR (1)  NOT NULL,
    LHOMONEY DECIMAL (15, 2)  NOT NULL,
    LHOYHSUSER VARCHAR (100)  NOT NULL,
    LHOYHSCOMPANY VARCHAR (100)  NOT NULL,
    LHOYHSDATE VARCHAR (8)  NOT NULL,
    LHOYHSTIME VARCHAR (6)  NOT NULL,
    LHOYHSCOMMENT VARCHAR (200)  NOT NULL
);

ALTER TABLE FDWLHO ADD
    CONSTRAINT PK_FDWLHO PRIMARY KEY
    (
        LHOID
    );

/******************************************
FDWLHM   系统流水勾对明细表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWLHM]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWLHM];
CREATE TABLE [dbo].[FDWLHM] (
    LHMID VARCHAR (32)  NOT NULL,
    LHMLHOID VARCHAR (32)  NOT NULL,
    LHMMBDTYPE VARCHAR (1)  NOT NULL,
    LHMMBDID VARCHAR (32)  NOT NULL,
    LHMMONEY DECIMAL (15, 2)  NOT NULL,
    LHMMBDNAME VARCHAR (100)  NOT NULL,
    LHMATKKIND VARCHAR (32)  NOT NULL
);

ALTER TABLE FDWLHM ADD
    CONSTRAINT PK_FDWLHM PRIMARY KEY
    (
        LHMID
    );

/******************************************
FDWINT   系统进账表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWINT]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWINT];
CREATE TABLE [dbo].[FDWINT] (
    INTID VARCHAR (32)  NOT NULL,
    INTATKKIND VARCHAR (32)  NOT NULL,
    INTMONEY DECIMAL (15, 2)  NOT NULL,
    INTMBDID VARCHAR (32)  NOT NULL,
    INTMBDTYPE VARCHAR (32)  NOT NULL,
    INTMBDNAME VARCHAR (100)  NOT NULL,
    INTBUIMBDID VARCHAR (32)  NOT NULL,
    INTBUINAME VARCHAR (100)  NOT NULL,
    INTACCOUNT VARCHAR (50)  NOT NULL,
    INTBNKID VARCHAR (32)  NOT NULL,
    INTBNKNAME VARCHAR (50)  NOT NULL,
    INTTRDDATE VARCHAR (8)  NOT NULL,
    INTCHECKNO VARCHAR (64)  NOT NULL,
    INTPURPOSE VARCHAR (100)  NOT NULL,
    INTSTATUS VARCHAR (1)  NOT NULL,
    INTCHKDATE VARCHAR (8)  NOT NULL,
    INTCHKTIME VARCHAR (6)  NOT NULL,
    INTCOMPANY VARCHAR (100)  NOT NULL,
    INTCHKUSR VARCHAR (50)  NOT NULL,
    INTPRISTATUS VARCHAR (1)  NOT NULL,
    INTPRIDATE VARCHAR (8)  NOT NULL,
    INTPRITIME VARCHAR (6)  NOT NULL
);

ALTER TABLE FDWINT ADD
    CONSTRAINT PK_FDWINT PRIMARY KEY
    (
        INTID
    );

/******************************************
FDWOUT   系统出账表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWOUT]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWOUT];
CREATE TABLE [dbo].[FDWOUT] (
    OUTID VARCHAR (32)  NOT NULL,
    OUTMODE VARCHAR (1)  NOT NULL,
    OUTMONEY DECIMAL (15, 2)  NOT NULL,
    OUTMBDID VARCHAR (32)  NOT NULL,
    OUTMBDTYPE VARCHAR (32)  NOT NULL,
    OUTMBDNAME VARCHAR (100)  NOT NULL,
    OUTBNKID VARCHAR (32)  NOT NULL,
    OUTFROMDEPNUM VARCHAR (100)  NOT NULL,
    OUTFROMBNKNAME VARCHAR (100)  NOT NULL,
    OUTFROMACCOUNT VARCHAR (100)  NOT NULL,
    OUTFROMBNKMAN VARCHAR (100)  NOT NULL,
    OUTDEPNUM VARCHAR (100)  NOT NULL,
    OUTBNKNAME VARCHAR (100)  NOT NULL,
    OUTACCOUNT VARCHAR (100)  NOT NULL,
    OUTBNKMAN VARCHAR (100)  NOT NULL,
    OUTBILLDATE VARCHAR (8)  NOT NULL,
    OUTTRDDATE VARCHAR (8)  NOT NULL,
    OUTCHECKNO VARCHAR (64)  NOT NULL,
    OUTPRNAME VARCHAR (100)  NOT NULL,
    OUTPURPOSE VARCHAR (100)  NOT NULL,
    OUTSTATUS VARCHAR (1)  NOT NULL,
    OUTCHKDATE VARCHAR (8)  NOT NULL,
    OUTCHKTIME VARCHAR (6)  NOT NULL,
    OUTCOMPANY VARCHAR (100)  NOT NULL,
    OUTCHKUSR VARCHAR (50)  NOT NULL,
    OUTPRISTATUS VARCHAR (1)  NOT NULL,
    OUTPRIDATE VARCHAR (8)  NOT NULL,
    OUTPRITIME VARCHAR (6)  NOT NULL,
    OUTCZSTATUS VARCHAR (1)  NOT NULL,
    OUTCZDATE VARCHAR (8)  NOT NULL,
    OUTWAY VARCHAR (100)  NOT NULL,
    OUTDATASTATUS VARCHAR (1)  NOT NULL,
    OUTDESC VARCHAR (1024)  NOT NULL,
    OUTISREFUND VARCHAR (1)  NOT NULL,
    OUTATKKIND VARCHAR (32)  NOT NULL
);

ALTER TABLE FDWOUT ADD
    CONSTRAINT PK_FDWOUT PRIMARY KEY
    (
        OUTID
    );

/******************************************
FDWRPB   系统报表表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWRPB]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWRPB];
CREATE TABLE [dbo].[FDWRPB] (
    RPBORGID VARCHAR (32)  NOT NULL,
    RPBPROID VARCHAR (50)  NOT NULL,
    RPBID VARCHAR (50)  NOT NULL,
    RPBNAME VARCHAR (64)  NOT NULL,
    RPBNUM INT  NOT NULL
);

ALTER TABLE FDWRPB ADD
    CONSTRAINT PK_FDWRPB PRIMARY KEY
    (
        RPBORGID,
        RPBPROID,
        RPBID
    );

/******************************************
FDWRPC   系统报表模板表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWRPC]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWRPC];
CREATE TABLE [dbo].[FDWRPC] (
    RPCORGID VARCHAR (32)  NOT NULL,
    RPCPROID VARCHAR (50)  NOT NULL,
    RPCPRUID VARCHAR (50)  NOT NULL,
    RPCFUNID VARCHAR (32)  NOT NULL,
    RPCBTNID VARCHAR (32)  NOT NULL,
    RPCYYYFIELD VARCHAR (50)  NOT NULL,
    RPCSTATUS VARCHAR (32)  NOT NULL,
    RPCRPBID VARCHAR (50)  NOT NULL,
    RPCNUM INT  NOT NULL
);

ALTER TABLE FDWRPC ADD
    CONSTRAINT PK_FDWRPC PRIMARY KEY
    (
        RPCORGID,
        RPCPROID,
        RPCPRUID,
        RPCFUNID,
        RPCBTNID,
        RPCYYYFIELD,
        RPCSTATUS,
        RPCRPBID
    );

/******************************************
FDWSEP   系统票据打印表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSEP]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSEP];
CREATE TABLE [dbo].[FDWSEP] (
    SEPID VARCHAR (32)  NOT NULL,
    SEPPROID VARCHAR (50)  NOT NULL,
    SEPTYPE VARCHAR (50)  NOT NULL,
    SEPNAME VARCHAR (200)  NOT NULL,
    SEPPRUID VARCHAR (50)  NOT NULL,
    SEPUNITID VARCHAR (32)  NOT NULL,
    SEPBNKID VARCHAR (32)  NOT NULL,
    SEPWIDTH INT  NOT NULL,
    SEPHEIGHT INT  NOT NULL,
    SEPOFFSETLEFT INT  NOT NULL,
    SEPOFFSETTOP INT  NOT NULL
);

ALTER TABLE FDWSEP ADD
    CONSTRAINT PK_FDWSEP PRIMARY KEY
    (
        SEPID
    );

/******************************************
FDWSEM   系统票据打印设置表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSEM]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSEM];
CREATE TABLE [dbo].[FDWSEM] (
    SEMSEPID VARCHAR (32)  NOT NULL,
    SEMKEY VARCHAR (100)  NOT NULL,
    SEMTOP INT  NOT NULL,
    SEMLEFT INT  NOT NULL,
    SEMALIGNMENT VARCHAR (1)  NOT NULL,
    SEMFONT VARCHAR (30)  NOT NULL,
    SEMSIZE INT  NOT NULL,
    SEMWORDSPACE INT  NOT NULL,
    SEMWIDTH INT  NOT NULL,
    SEMHEIGHT INT  NOT NULL,
    SEMISLOCAL VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWSEM ADD
    CONSTRAINT PK_FDWSEM PRIMARY KEY
    (
        SEMSEPID,
        SEMKEY
    );

/******************************************
FDWBMR   业务票据关联表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWBMR]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWBMR];
CREATE TABLE [dbo].[FDWBMR] (
    BMRMBDID VARCHAR (32)  NOT NULL,
    BMRSEPTYPE VARCHAR (50)  NOT NULL,
    BMRVCHIDUNIT VARCHAR (100)  NOT NULL
);

ALTER TABLE FDWBMR ADD
    CONSTRAINT PK_FDWBMR PRIMARY KEY
    (
        BMRMBDID,
        BMRSEPTYPE
    );

/******************************************
FDWSDM   系统字段值配置表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSDM]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSDM];
CREATE TABLE [dbo].[FDWSDM] (
    SDMORGID VARCHAR (32)  NOT NULL,
    SDMNAME VARCHAR (30)  NOT NULL,
    SDMVALUE VARCHAR (30)  NOT NULL,
    SDMDESC VARCHAR (50)  NOT NULL,
    SDMNUM INT  NOT NULL
);

ALTER TABLE FDWSDM ADD
    CONSTRAINT PK_FDWSDM PRIMARY KEY
    (
        SDMORGID,
        SDMNAME,
        SDMVALUE
    );

/******************************************
FDWBNK   银行表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWBNK]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWBNK];
CREATE TABLE [dbo].[FDWBNK] (
    BNKID VARCHAR (32)  NOT NULL,
    BNKNAME VARCHAR (50)  NOT NULL,
    BNKACTNO VARCHAR (100)  NOT NULL,
    BNKACTTYPE VARCHAR (512)  NOT NULL,
    BNKPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    BNKLIC VARCHAR (512)  NOT NULL,
    BNKLICCODE VARCHAR (32)  NOT NULL,
    BNKADDRSS VARCHAR (200)  NOT NULL,
    BNKLINKMAN VARCHAR (50)  NOT NULL,
    BNKRELTEL VARCHAR (20)  NOT NULL,
    BNKZIPCODE VARCHAR (6)  NOT NULL,
    BNKCOMMENT VARCHAR (200)  NOT NULL,
    BNKLIMIT DECIMAL (15, 2)  NOT NULL,
    BNKLIMITMONTH VARCHAR (8)  NOT NULL,
    BNKLIMITBAL DECIMAL (15, 2)  NOT NULL,
    BNKOFFICES VARCHAR (512)  NOT NULL,
    BNKONLINE VARCHAR (1)  NOT NULL,
    BNKSTATUS VARCHAR (1)  NOT NULL,
    BNKBUSINESSCODE VARCHAR (32)  NOT NULL
);

ALTER TABLE FDWBNK ADD
    CONSTRAINT PK_FDWBNK PRIMARY KEY
    (
        BNKID
    );

/******************************************
FDWBNC   银行账户表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWBNC]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWBNC];
CREATE TABLE [dbo].[FDWBNC] (
    BNCID VARCHAR (32)  NOT NULL,
    BNCBNKID VARCHAR (32)  NOT NULL,
    BNCBNKNUM VARCHAR (100)  NOT NULL,
    BNCBNKNAME VARCHAR (100)  NOT NULL,
    BNCBNKNO VARCHAR (100)  NOT NULL,
    BNCBNKACTNAME VARCHAR (100)  NOT NULL,
    BNCADDRSS VARCHAR (200)  NOT NULL,
    BNCRELTEL VARCHAR (20)  NOT NULL,
    BNCHOOKDATE VARCHAR (8)  NOT NULL,
    BNCPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    BNCINOUTSIGN VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWBNC ADD
    CONSTRAINT PK_FDWBNC PRIMARY KEY
    (
        BNCID
    );

/******************************************
FDWDOT   银行网点表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWDOT]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWDOT];
CREATE TABLE [dbo].[FDWDOT] (
    DOTID VARCHAR (32)  NOT NULL,
    DOTNO VARCHAR (100)  NOT NULL,
    DOTNAME VARCHAR (100)  NOT NULL,
    DOTISSPECIAL VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWDOT ADD
    CONSTRAINT PK_FDWDOT PRIMARY KEY
    (
        DOTID
    );

/******************************************
FDWDTR   城区表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWDTR]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWDTR];
CREATE TABLE [dbo].[FDWDTR] (
    DTRID VARCHAR (32)  NOT NULL,
    DTRNAME VARCHAR (40)  NOT NULL,
    DTRNUM VARCHAR (16)  NOT NULL,
    DTRCODE VARCHAR (64)  NOT NULL,
    DTRONLINE VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWDTR ADD
    CONSTRAINT PK_FDWDTR PRIMARY KEY
    (
        DTRID
    );

/******************************************
FDWSTR   街道表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSTR]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSTR];
CREATE TABLE [dbo].[FDWSTR] (
    STRID VARCHAR (32)  NOT NULL,
    STRNUM VARCHAR (16)  NOT NULL,
    STRFULLNUM VARCHAR (32)  NOT NULL,
    STRNAME VARCHAR (64)  NOT NULL,
    STRDTRID VARCHAR (32)  NOT NULL,
    STRONLINE VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWSTR ADD
    CONSTRAINT PK_FDWSTR PRIMARY KEY
    (
        STRID
    );

/******************************************
FDWCTY   社区表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWCTY]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWCTY];
CREATE TABLE [dbo].[FDWCTY] (
    CTYID VARCHAR (32)  NOT NULL,
    CTYNUM VARCHAR (16)  NOT NULL,
    CTYFULLNUM VARCHAR (32)  NOT NULL,
    CTYNAME VARCHAR (64)  NOT NULL,
    CTYDTRID VARCHAR (32)  NOT NULL,
    CTYSTRID VARCHAR (32)  NOT NULL,
    CTYLINKMAN VARCHAR (50)  NOT NULL,
    CTYLINKTEL VARCHAR (50)  NOT NULL,
    CTYLINKMANMBL VARCHAR (50)  NOT NULL,
    CTYBNKMAN VARCHAR (100)  NOT NULL,
    CTYBNKNAME VARCHAR (100)  NOT NULL,
    CTYBNKNO VARCHAR (100)  NOT NULL,
    CTYONLINE VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWCTY ADD
    CONSTRAINT PK_FDWCTY PRIMARY KEY
    (
        CTYID
    );

/******************************************
FDWBDR   开发建设单位表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWBDR]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWBDR];
CREATE TABLE [dbo].[FDWBDR] (
    BDRID VARCHAR (32)  NOT NULL,
    BDRNAME VARCHAR (100)  NOT NULL,
    BDRADDR VARCHAR (100)  NOT NULL,
    BDRLINKMAN VARCHAR (50)  NOT NULL,
    BDRLINKTEL VARCHAR (50)  NOT NULL,
    BDRLINKJOB VARCHAR (100)  NOT NULL,
    BDRLINKFAX VARCHAR (50)  NOT NULL,
    BDRZIPCODE VARCHAR (6)  NOT NULL,
    BDRFUNCRY VARCHAR (50)  NOT NULL,
    BDRFUNCRYTEL VARCHAR (50)  NOT NULL,
    BDRFUNCRYMBL VARCHAR (50)  NOT NULL,
    BDRLINKMANMBL VARCHAR (50)  NOT NULL,
    BDREMAIL VARCHAR (100)  NOT NULL,
    BDRREGFND INT  NOT NULL,
    BDRPRADATE VARCHAR (8)  NOT NULL,
    BDRYCSDATE VARCHAR (8)  NOT NULL,
    BDRYCSCIRCS VARCHAR (200)  NOT NULL,
    BDRCPKCD VARCHAR (100)  NOT NULL,
    BDREQLCD VARCHAR (100)  NOT NULL,
    BDRQLFBOOKNO VARCHAR (50)  NOT NULL,
    BDRQLFSIGNDATE VARCHAR (8)  NOT NULL,
    BDRQLFVLDDATE VARCHAR (8)  NOT NULL,
    BDRAPPDATE VARCHAR (8)  NOT NULL,
    BDRAPPBOOKNO VARCHAR (50)  NOT NULL,
    BDREMWORKERNUM INT  NOT NULL,
    BDRMNGRNUM INT  NOT NULL,
    BDRCOMMENT VARCHAR (200)  NOT NULL,
    BDRNUM VARCHAR (20)  NOT NULL,
    BDRCODE VARCHAR (64)  NOT NULL,
    BDRONLINE VARCHAR (1)  NOT NULL,
    BDRSTATUS VARCHAR (1)  NOT NULL,
    BDRBUSINESSCODE VARCHAR (32)  NOT NULL,
    BDRREGISTERNO VARCHAR (32)  NOT NULL,
    BDRREGISTERSTATUS VARCHAR (1)  NOT NULL,
    BDRREGISTERDATE VARCHAR (8)  NOT NULL
);

ALTER TABLE FDWBDR ADD
    CONSTRAINT PK_FDWBDR PRIMARY KEY
    (
        BDRID
    );

/******************************************
FDWEMC   物业公司表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWEMC]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWEMC];
CREATE TABLE [dbo].[FDWEMC] (
    EMCID VARCHAR (32)  NOT NULL,
    EMCNAME VARCHAR (100)  NOT NULL,
    EMCPERSON VARCHAR (100)  NOT NULL,
    EMCADDR VARCHAR (100)  NOT NULL,
    EMCLINKMAN VARCHAR (50)  NOT NULL,
    EMCLINKTEL VARCHAR (50)  NOT NULL,
    EMCLINKMANMBL VARCHAR (50)  NOT NULL,
    EMCLINKFAX VARCHAR (50)  NOT NULL,
    EMCZIPCODE VARCHAR (6)  NOT NULL,
    EMCFUNCRY VARCHAR (50)  NOT NULL,
    EMCFUNCRYMBL VARCHAR (50)  NOT NULL,
    EMCFUNCRYTEL VARCHAR (50)  NOT NULL,
    EMCFINLINKMAN VARCHAR (50)  NOT NULL,
    EMCFINLINKTEL VARCHAR (50)  NOT NULL,
    EMCFINLINKMANMBL VARCHAR (50)  NOT NULL,
    EMCFINFUNCRY VARCHAR (50)  NOT NULL,
    EMCFINFUNCRYMBL VARCHAR (50)  NOT NULL,
    EMCFINFUNCRYTEL VARCHAR (50)  NOT NULL,
    EMCREGFND INT  NOT NULL,
    EMCPRADATE VARCHAR (8)  NOT NULL,
    EMCYCSDATE VARCHAR (8)  NOT NULL,
    EMCYCSCIRCS VARCHAR (200)  NOT NULL,
    EMCCPKCD VARCHAR (100)  NOT NULL,
    EMCEQLCD VARCHAR (100)  NOT NULL,
    EMCQLFBOOKNO VARCHAR (50)  NOT NULL,
    EMCQLFSIGNDATE VARCHAR (8)  NOT NULL,
    EMCQLFVLDDATE VARCHAR (8)  NOT NULL,
    EMCAPPDATE VARCHAR (8)  NOT NULL,
    EMCAPPBOOKNO VARCHAR (50)  NOT NULL,
    EMCEMWORKERNUM INT  NOT NULL,
    EMCMNGRNUM INT  NOT NULL,
    EMCCOMMENT VARCHAR (200)  NOT NULL,
    EMCONLINE VARCHAR (1)  NOT NULL,
    EMCSTATUS VARCHAR (1)  NOT NULL,
    EMCBUSINESSCODE VARCHAR (32)  NOT NULL,
    EMCLOGINNAME VARCHAR (64)  NOT NULL,
    EMCBNKMAN VARCHAR (100)  NOT NULL,
    EMCBNKNUM VARCHAR (100)  NOT NULL,
    EMCBNKNAME VARCHAR (100)  NOT NULL,
    EMCEMCBNKNO VARCHAR (100)  NOT NULL,
    EMCBNKSBA VARCHAR (100)  NOT NULL,
    EMCBNKSBANUM VARCHAR (100)  NOT NULL,
    EMCBNKDEPOSIT VARCHAR (100)  NOT NULL,
    EMCSBANO VARCHAR (100)  NOT NULL,
    EMCEMAIL VARCHAR (100)  NOT NULL,
    EMCREGISTERNO VARCHAR (32)  NOT NULL,
    EMCREGISTERSTATUS VARCHAR (1)  NOT NULL,
    EMCREGISTERDATE VARCHAR (8)  NOT NULL,
    EMCISBINDING VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWEMC ADD
    CONSTRAINT PK_FDWEMC PRIMARY KEY
    (
        EMCID
    );

/******************************************
FDWEMH   小区物业公司变更历史表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWEMH]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWEMH];
CREATE TABLE [dbo].[FDWEMH] (
    EMHID VARCHAR (32)  NOT NULL,
    EMHSRQID VARCHAR (32)  NOT NULL,
    EMHOLDEMCID VARCHAR (32)  NOT NULL,
    EMHOLDEMOID VARCHAR (32)  NOT NULL,
    EMHNEWEMCID VARCHAR (32)  NOT NULL,
    EMHNEWEMOID VARCHAR (32)  NOT NULL,
    EMHYHSUSER VARCHAR (50)  NOT NULL,
    EMHYHSCOMPANY VARCHAR (100)  NOT NULL,
    EMHYHSDATE VARCHAR (8)  NOT NULL,
    EMHYHSTIME VARCHAR (6)  NOT NULL,
    EMHYHSCOMMENT VARCHAR (2000)  NOT NULL
);

ALTER TABLE FDWEMH ADD
    CONSTRAINT PK_FDWEMH PRIMARY KEY
    (
        EMHID
    );

/******************************************
FDWEMO   物业管理处
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWEMO]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWEMO];
CREATE TABLE [dbo].[FDWEMO] (
    EMOID VARCHAR (32)  NOT NULL,
    EMOEMCID VARCHAR (32)  NOT NULL,
    EMONAME VARCHAR (100)  NOT NULL,
    EMOLINKMAN VARCHAR (50)  NOT NULL,
    EMOLINKTEL VARCHAR (50)  NOT NULL,
    EMOLINKMANMBL VARCHAR (50)  NOT NULL,
    EMOLINKFAX VARCHAR (50)  NOT NULL,
    EMOZIPCODE VARCHAR (6)  NOT NULL,
    EMOMAILADDRESS VARCHAR (200)  NOT NULL,
    EMOFUNCRY VARCHAR (50)  NOT NULL,
    EMOFUNCRYMBL VARCHAR (50)  NOT NULL,
    EMOFUNTEL VARCHAR (50)  NOT NULL,
    EMOONLINE VARCHAR (1)  NOT NULL,
    EMOSTATUS VARCHAR (1)  NOT NULL,
    EMODELSIGN VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWEMO ADD
    CONSTRAINT PK_FDWEMO PRIMARY KEY
    (
        EMOID
    );

/******************************************
FDWEHA   物业合同备案表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWEHA]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWEHA];
CREATE TABLE [dbo].[FDWEHA] (
    EHAID VARCHAR (32)  NOT NULL,
    EHANO VARCHAR (10)  NOT NULL,
    EHASRQID VARCHAR (32)  NOT NULL,
    EHASRQNAME VARCHAR (50)  NOT NULL,
    EHALOCATION VARCHAR (100)  NOT NULL,
    EHAMANAGER VARCHAR (16)  NOT NULL,
    EHAPHONENUM VARCHAR (50)  NOT NULL,
    EHAOCCID VARCHAR (32)  NOT NULL,
    EHAOCCNAME VARCHAR (100)  NOT NULL,
    EHAEMCID VARCHAR (32)  NOT NULL,
    EHAEMCNAME VARCHAR (100)  NOT NULL,
    EHABDRID VARCHAR (32)  NOT NULL,
    EHABDRNAME VARCHAR (100)  NOT NULL,
    EHADATE VARCHAR (8)  NOT NULL,
    EHAPACTDDATE VARCHAR (8)  NOT NULL,
    EHABEGDATE VARCHAR (8)  NOT NULL,
    EHAENDDATE VARCHAR (8)  NOT NULL,
    EHAHOUROMAREA DECIMAL (15, 4)  NOT NULL,
    EHABUSROMAREA DECIMAL (15, 4)  NOT NULL,
    EHAOFFAREA DECIMAL (15, 4)  NOT NULL,
    EHAOTHERAREA DECIMAL (15, 4)  NOT NULL,
    EHACOMAREA DECIMAL (15, 4)  NOT NULL,
    EHAAREA DECIMAL (15, 4)  NOT NULL,
    EHAUNDERAREA DECIMAL (15, 2)  NOT NULL,
    EHACARAREA DECIMAL (15, 4)  NOT NULL,
    EHANONCARAREA DECIMAL (15, 4)  NOT NULL,
    EHAEMPAREA DECIMAL (15, 4)  NOT NULL,
    EHAGRNDAREA DECIMAL (15, 4)  NOT NULL,
    EHAALLAREA DECIMAL (15, 4)  NOT NULL,
    EHAAPANAGE VARCHAR (50)  NOT NULL,
    EHACOMMITTEE VARCHAR (50)  NOT NULL,
    EHAAPPPSN VARCHAR (20)  NOT NULL,
    EHAAPPDESC VARCHAR (100)  NOT NULL,
    EHAAPPDATE VARCHAR (8)  NOT NULL,
    EHAACPTUSR VARCHAR (20)  NOT NULL,
    EHAACPTDESC VARCHAR (100)  NOT NULL,
    EHAACPTDATE VARCHAR (8)  NOT NULL,
    EHAAUTHUSR VARCHAR (20)  NOT NULL,
    EHAAUTHDESC VARCHAR (100)  NOT NULL,
    EHAAUTHDATE VARCHAR (8)  NOT NULL,
    EHAFIRST VARCHAR (100)  NOT NULL,
    EHALAWMAN VARCHAR (50)  NOT NULL,
    EHALAWTEL VARCHAR (50)  NOT NULL,
    EHALINKMAN VARCHAR (50)  NOT NULL,
    EHALINKTEL VARCHAR (50)  NOT NULL,
    EHASECOND VARCHAR (100)  NOT NULL,
    EHASECLAWMAN VARCHAR (50)  NOT NULL,
    EHASECLAWTEL VARCHAR (50)  NOT NULL,
    EHASECLINKMAN VARCHAR (50)  NOT NULL,
    EHASECLINKTEL VARCHAR (50)  NOT NULL,
    EHAPSNDESC TEXT  NOT NULL,
    EHASTATUS VARCHAR (1)  NOT NULL,
    EHAREMARK VARCHAR (200)  NOT NULL
);

ALTER TABLE FDWEHA ADD
    CONSTRAINT PK_FDWEHA PRIMARY KEY
    (
        EHAID
    );

/******************************************
FDWOCC   业主委员会表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWOCC]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWOCC];
CREATE TABLE [dbo].[FDWOCC] (
    OCCID VARCHAR (32)  NOT NULL,
    OCCNAME VARCHAR (100)  NOT NULL,
    OCCSRQID VARCHAR (32)  NOT NULL,
    OCCADDR VARCHAR (100)  NOT NULL,
    OCCLINKMAN VARCHAR (50)  NOT NULL,
    OCCLINKTEL VARCHAR (50)  NOT NULL,
    OCCLINKMBL VARCHAR (50)  NOT NULL,
    OCCLINKJOB VARCHAR (100)  NOT NULL,
    OCCLINKFAX VARCHAR (50)  NOT NULL,
    OCCZIPCODE VARCHAR (6)  NOT NULL,
    OCCAPPBOOKNO VARCHAR (50)  NOT NULL,
    OCCAPPDATE VARCHAR (8)  NOT NULL,
    OCCBNKNUM VARCHAR (100)  NOT NULL,
    OCCDEPBNK VARCHAR (100)  NOT NULL,
    OCCBNKACT VARCHAR (100)  NOT NULL,
    OCCBNKPER VARCHAR (100)  NOT NULL,
    OCCDEPLOC VARCHAR (100)  NOT NULL,
    OCCDEPDATE VARCHAR (8)  NOT NULL,
    OCCMAKDATE VARCHAR (8)  NOT NULL,
    OCCENDDATE VARCHAR (8)  NOT NULL,
    OCCROMNUM INT  NOT NULL,
    OCCBLDNUM INT  NOT NULL,
    OCCDTRID VARCHAR (32)  NOT NULL,
    OCCSTRID VARCHAR (32)  NOT NULL,
    OCCMNGDEPT VARCHAR (50)  NOT NULL,
    OCCCOMMENT VARCHAR (200)  NOT NULL,
    OCCNUM VARCHAR (8)  NOT NULL,
    OCCONLINE VARCHAR (1)  NOT NULL,
    OCCSTATUS VARCHAR (1)  NOT NULL,
    OCCORGCODE VARCHAR (32)  NOT NULL,
    OCCREGISTERNO VARCHAR (32)  NOT NULL,
    OCCREGISTERSTATUS VARCHAR (1)  NOT NULL,
    OCCREGISTERDATE VARCHAR (8)  NOT NULL,
    OCCEMAIL VARCHAR (100)  NOT NULL,
    OCCISBINDING VARCHAR (1)  NOT NULL,
    OCCBNKSBA VARCHAR (100)  NOT NULL,
    OCCBNKSBANUM VARCHAR (100)  NOT NULL,
    OCCBNKDEPOSIT VARCHAR (100)  NOT NULL,
    OCCSBANO VARCHAR (100)  NOT NULL
);

ALTER TABLE FDWOCC ADD
    CONSTRAINT PK_FDWOCC PRIMARY KEY
    (
        OCCID
    );

/******************************************
FDWOCD   业主委员会成员明细表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWOCD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWOCD];
CREATE TABLE [dbo].[FDWOCD] (
    OCDID VARCHAR (32)  NOT NULL,
    OCDOCCID VARCHAR (32)  NOT NULL,
    OCDNAME VARCHAR (100)  NOT NULL,
    OCDADDR VARCHAR (100)  NOT NULL,
    OCDLINKTEL VARCHAR (50)  NOT NULL,
    OCDDUTY VARCHAR (50)  NOT NULL
);

ALTER TABLE FDWOCD ADD
    CONSTRAINT PK_FDWOCD PRIMARY KEY
    (
        OCDID
    );

/******************************************
FDWAUD   审价机构表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWAUD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWAUD];
CREATE TABLE [dbo].[FDWAUD] (
    AUDID VARCHAR (32)  NOT NULL,
    AUDNAME VARCHAR (50)  NOT NULL,
    AUDPERSON VARCHAR (100)  NOT NULL,
    AUDADDR VARCHAR (100)  NOT NULL,
    AUDLINKMAN VARCHAR (50)  NOT NULL,
    AUDLINKMANMBL VARCHAR (50)  NOT NULL,
    AUDLINKTEL VARCHAR (50)  NOT NULL,
    AUDLINKFAX VARCHAR (50)  NOT NULL,
    AUDZIPCODE VARCHAR (6)  NOT NULL,
    AUDFUNCRY VARCHAR (50)  NOT NULL,
    AUDFUNCRYMBL VARCHAR (50)  NOT NULL,
    AUDFUNCRYTEL VARCHAR (50)  NOT NULL,
    AUDREGFND INT  NOT NULL,
    AUDPRADATE VARCHAR (8)  NOT NULL,
    AUDYCSDATE VARCHAR (8)  NOT NULL,
    AUDYCSCIRCS VARCHAR (200)  NOT NULL,
    AUDCPKCD VARCHAR (100)  NOT NULL,
    AUDEQLCD VARCHAR (100)  NOT NULL,
    AUDQLFBOOKNO VARCHAR (50)  NOT NULL,
    AUDQLFSIGNDATE VARCHAR (8)  NOT NULL,
    AUDQLFVLDDATE VARCHAR (8)  NOT NULL,
    AUDEMWORKERNUM INT  NOT NULL,
    AUDMNGRNUM INT  NOT NULL,
    AUDCOMMENT VARCHAR (200)  NOT NULL,
    AUDNUM VARCHAR (20)  NOT NULL,
    AUDONLINE VARCHAR (1)  NOT NULL,
    AUDSTATUS VARCHAR (1)  NOT NULL,
    AUDBUSINESSCODE VARCHAR (32)  NOT NULL,
    AUDPROJECTTYPE1 VARCHAR (50)  NOT NULL,
    AUDPERSONNEL1 VARCHAR (50)  NOT NULL,
    AUDPERSONTEL1 VARCHAR (50)  NOT NULL,
    AUDPERSONMBL1 VARCHAR (50)  NOT NULL,
    AUDPERSONEML1 VARCHAR (100)  NOT NULL,
    AUDPROJECTTYPE2 VARCHAR (50)  NOT NULL,
    AUDPERSONNEL2 VARCHAR (50)  NOT NULL,
    AUDPERSONTEL2 VARCHAR (50)  NOT NULL,
    AUDPERSONMBL2 VARCHAR (50)  NOT NULL,
    AUDPERSONEML2 VARCHAR (100)  NOT NULL,
    AUDPROJECTTYPE3 VARCHAR (50)  NOT NULL,
    AUDPERSONNEL3 VARCHAR (50)  NOT NULL,
    AUDPERSONTEL3 VARCHAR (50)  NOT NULL,
    AUDPERSONMBL3 VARCHAR (50)  NOT NULL,
    AUDPERSONEML3 VARCHAR (100)  NOT NULL,
    AUDPROJECTTYPE4 VARCHAR (50)  NOT NULL,
    AUDPERSONNEL4 VARCHAR (50)  NOT NULL,
    AUDPERSONTEL4 VARCHAR (50)  NOT NULL,
    AUDPERSONMBL4 VARCHAR (50)  NOT NULL,
    AUDPERSONEML4 VARCHAR (100)  NOT NULL,
    AUDMAILADDR VARCHAR (200)  NOT NULL,
    AUDACCEPTDATE VARCHAR (200)  NOT NULL,
    AUDREDFIELDS1 TEXT  NOT NULL,
    AUDREDFIELDS2 TEXT  NOT NULL
);

ALTER TABLE FDWAUD ADD
    CONSTRAINT PK_FDWAUD PRIMARY KEY
    (
        AUDID
    );

/******************************************
FDWVND   房改房售房单位表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWVND]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWVND];
CREATE TABLE [dbo].[FDWVND] (
    VNDID VARCHAR (32)  NOT NULL,
    VNDNAME VARCHAR (50)  NOT NULL,
    VNDADDR VARCHAR (100)  NOT NULL,
    VNDLINKMAN VARCHAR (50)  NOT NULL,
    VNDLINKTEL VARCHAR (50)  NOT NULL,
    VNDFUNCRY VARCHAR (50)  NOT NULL,
    VNDCOMMENT VARCHAR (200)  NOT NULL
);

ALTER TABLE FDWVND ADD
    CONSTRAINT PK_FDWVND PRIMARY KEY
    (
        VNDID
    );

/******************************************
FDWSRS   小区专户绑定表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSRS]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSRS];
CREATE TABLE [dbo].[FDWSRS] (
    SRSID VARCHAR (32)  NOT NULL,
    SRSSRQID VARCHAR (32)  NOT NULL,
    SRSACTKIND VARCHAR (32)  NOT NULL,
    SRSMBDTYPE VARCHAR (20)  NOT NULL,
    SRSSBAID VARCHAR (32)  NOT NULL,
    SRSBUSISTATUS VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWSRS ADD
    CONSTRAINT PK_FDWSRS PRIMARY KEY
    (
        SRSID
    );

/******************************************
FDWSRQ   小区表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSRQ]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSRQ];
CREATE TABLE [dbo].[FDWSRQ] (
    SRQID VARCHAR (32)  NOT NULL,
    SRQNAME VARCHAR (50)  NOT NULL,
    SRQDTRID VARCHAR (32)  NOT NULL,
    SRQSTRID VARCHAR (32)  NOT NULL,
    SRQADDR VARCHAR (100)  NOT NULL,
    SRQCTYID VARCHAR (32)  NOT NULL,
    SRQCTYNAME VARCHAR (64)  NOT NULL,
    SRQEMCID VARCHAR (32)  NOT NULL,
    SRQEMCNAME VARCHAR (100)  NOT NULL,
    SRQEMOID VARCHAR (32)  NOT NULL,
    SRQEMONAME VARCHAR (100)  NOT NULL,
    SRQOCCID VARCHAR (32)  NOT NULL,
    SRQOCCNAME VARCHAR (100)  NOT NULL,
    SRQBDRID VARCHAR (32)  NOT NULL,
    SRQBDRNAME VARCHAR (100)  NOT NULL,
    SRQWORKROMLOC VARCHAR (512)  NOT NULL,
    SRQWORKROMAREA DECIMAL (15, 4)  NOT NULL,
    SRQBUSROMLOC VARCHAR (512)  NOT NULL,
    SRQBUSROMAREA DECIMAL (15, 4)  NOT NULL,
    SRQPUBROMLOC VARCHAR (512)  NOT NULL,
    SRQPUBROMAREA DECIMAL (15, 4)  NOT NULL,
    SRQPROPERTYTYPE VARCHAR (32)  NOT NULL,
    SRQMANPAY DECIMAL (15, 2)  NOT NULL,
    SRQCOMMENT VARCHAR (200)  NOT NULL,
    SRQGRNDAREA DECIMAL (15, 4)  NOT NULL,
    SRQSTRDATE VARCHAR (8)  NOT NULL,
    SRQFNSDATE VARCHAR (8)  NOT NULL,
    SRQBLDNUM INT  NOT NULL,
    SRQROOMNUM INT  NOT NULL,
    SRQHOUROMNUM INT  NOT NULL,
    SRQHOUROMAREA DECIMAL (15, 4)  NOT NULL,
    SRQBHUROMNUM INT  NOT NULL,
    SRQBHUROMAREA DECIMAL (15, 4)  NOT NULL,
    SRQSTATUS VARCHAR (1)  NOT NULL,
    SRQNUM VARCHAR (16)  NOT NULL,
    SRQFULLNUM VARCHAR (48)  NOT NULL,
    SRQACCOUNTNUM VARCHAR (20)  NOT NULL,
    SRQINITSTATUS VARCHAR (1)  NOT NULL,
    SRQACCDATE VARCHAR (8)  NOT NULL,
    SRQTRADITIONSRQID VARCHAR (32)  NOT NULL,
    SRQBUSISTATUS VARCHAR (1)  NOT NULL,
    SRQFORMERNAME VARCHAR (50)  NOT NULL
);

ALTER TABLE FDWSRQ ADD
    CONSTRAINT PK_FDWSRQ PRIMARY KEY
    (
        SRQID
    );

/******************************************
FDWBSG   楼幢小区变更表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWBSG]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWBSG];
CREATE TABLE [dbo].[FDWBSG] (
    BSGID VARCHAR (32)  NOT NULL,
    BSGBLDID VARCHAR (32)  NOT NULL,
    BSGOLDSRQID VARCHAR (32)  NOT NULL,
    BSGNEWSRQID VARCHAR (32)  NOT NULL,
    BSGDATE VARCHAR (8)  NOT NULL,
    BSGTIME VARCHAR (6)  NOT NULL
);

ALTER TABLE FDWBSG ADD
    CONSTRAINT PK_FDWBSG PRIMARY KEY
    (
        BSGID
    );

/******************************************
FDWSBG   小区与开发建设单位关系表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSBG]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSBG];
CREATE TABLE [dbo].[FDWSBG] (
    SBGID VARCHAR (32)  NOT NULL,
    SBGSRQID VARCHAR (32)  NOT NULL,
    SBGBDRID VARCHAR (32)  NOT NULL
);

ALTER TABLE FDWSBG ADD
    CONSTRAINT PK_FDWSBG PRIMARY KEY
    (
        SBGID
    );

/******************************************
FDWCON   工程项目表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWCON]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWCON];
CREATE TABLE [dbo].[FDWCON] (
    CONID VARCHAR (32)  NOT NULL,
    CONSRQID VARCHAR (32)  NOT NULL,
    CONSRQNAME VARCHAR (100)  NOT NULL,
    CONNAME VARCHAR (200)  NOT NULL,
    CONADDR VARCHAR (100)  NOT NULL,
    CONBDRID VARCHAR (32)  NOT NULL,
    CONBDRNAME VARCHAR (100)  NOT NULL,
    CONCOMMENT VARCHAR (200)  NOT NULL,
    CONBLDNUM INT  NOT NULL,
    CONAREA DECIMAL (9, 2)  NOT NULL,
    CONPPAYMONEY DECIMAL (15, 2)  NOT NULL,
    CONPFACTPAY DECIMAL (15, 2)  NOT NULL,
    CONFNSDATE VARCHAR (8)  NOT NULL,
    CONHANDDATE VARCHAR (8)  NOT NULL,
    CONSECDESC VARCHAR (500)  NOT NULL,
    CONLINKNAME VARCHAR (32)  NOT NULL,
    CONLINKTEL VARCHAR (20)  NOT NULL,
    CONPAYBASE DECIMAL (15, 2)  NOT NULL,
    CONPPAYRATE DECIMAL (9, 2)  NOT NULL,
    CONBACKMONEY DECIMAL (15, 2)  NOT NULL,
    CONBACKNUM INT  NOT NULL,
    CONBACKDATE VARCHAR (8)  NOT NULL,
    CONACTSTADATE VARCHAR (8)  NOT NULL
);

ALTER TABLE FDWCON ADD
    CONSTRAINT PK_FDWCON PRIMARY KEY
    (
        CONID
    );

/******************************************
FDWBCC   工程开发商变更表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWBCC]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWBCC];
CREATE TABLE [dbo].[FDWBCC] (
    BCCID VARCHAR (32)  NOT NULL,
    BCCNO VARCHAR (32)  NOT NULL,
    BCCAFTERBDRID VARCHAR (32)  NOT NULL,
    BCCBEFOREBDRID VARCHAR (32)  NOT NULL,
    BCCCONID VARCHAR (32)  NOT NULL,
    BCCREASON VARCHAR (1000)  NOT NULL,
    BCCSTATUS VARCHAR (1)  NOT NULL,
    BCCYHSUSER VARCHAR (50)  NOT NULL,
    BCCYHSCOMPANY VARCHAR (100)  NOT NULL,
    BCCYHSDATE VARCHAR (8)  NOT NULL,
    BCCYHSTIME VARCHAR (6)  NOT NULL,
    BCCYHSCOMMENT VARCHAR (2000)  NOT NULL,
    BCCORIMBDTYPE VARCHAR (32)  NOT NULL,
    BCCORIMBDID VARCHAR (32)  NOT NULL,
    BCCLINKMAN VARCHAR (50)  NOT NULL,
    BCCLINKTEL VARCHAR (50)  NOT NULL
);

ALTER TABLE FDWBCC ADD
    CONSTRAINT PK_FDWBCC PRIMARY KEY
    (
        BCCID
    );

/******************************************
FDWBLD   楼幢表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWBLD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWBLD];
CREATE TABLE [dbo].[FDWBLD] (
    BLDID VARCHAR (32)  NOT NULL,
    BLDSRQID VARCHAR (32)  NOT NULL,
    BLDSRQNAME VARCHAR (50)  NOT NULL,
    BLDCONID VARCHAR (32)  NOT NULL,
    BLDNO VARCHAR (100)  NOT NULL,
    BLDOCCID VARCHAR (32)  NOT NULL,
    BLDOCCNAME VARCHAR (100)  NOT NULL,
    BLDEMCID VARCHAR (32)  NOT NULL,
    BLDEMCNAME VARCHAR (100)  NOT NULL,
    BLDDTRID VARCHAR (32)  NOT NULL,
    BLDBDRID VARCHAR (32)  NOT NULL,
    BLDBDRNAME VARCHAR (100)  NOT NULL,
    BLDVNDID VARCHAR (32)  NOT NULL,
    BLDVNDNAME VARCHAR (50)  NOT NULL,
    BLDSTRUCT VARCHAR (100)  NOT NULL,
    BLDFNSDATE VARCHAR (8)  NOT NULL,
    BLDHANDDATE VARCHAR (8)  NOT NULL,
    BLDDESCR VARCHAR (50)  NOT NULL,
    BLDAREA DECIMAL (15, 4)  NOT NULL,
    BLDKEEYAREA DECIMAL (15, 4)  NOT NULL,
    BLDREMARK VARCHAR (200)  NOT NULL,
    BLDTYPE VARCHAR (100)  NOT NULL,
    BLDPURPOSE VARCHAR (100)  NOT NULL,
    BLDKIND VARCHAR (32)  NOT NULL,
    BLDFLOORNUM INT  NOT NULL,
    BLDROOMNUM INT  NOT NULL,
    BLDACTCONTRFLG VARCHAR (100)  NOT NULL,
    BLDMANPAY DECIMAL (15, 2)  NOT NULL,
    BLDCOMPPAY DECIMAL (15, 2)  NOT NULL,
    BLDMANFACTPAY DECIMAL (15, 2)  NOT NULL,
    BLDCOMPFACTPAY DECIMAL (15, 2)  NOT NULL,
    BLDPAYBASE VARCHAR (20)  NOT NULL,
    BLDPAYPERPSN DECIMAL (9, 2)  NOT NULL,
    BLDPAYPERCOMP DECIMAL (9, 2)  NOT NULL,
    BLDGOLDPAY DECIMAL (15, 2)  NOT NULL,
    BLDSTATUS VARCHAR (1)  NOT NULL,
    BLDNUM VARCHAR (16)  NOT NULL,
    BLDFULLNUM VARCHAR (64)  NOT NULL,
    BLDOCCNUM VARCHAR (8)  NOT NULL,
    BLDPAYMODE VARCHAR (100)  NOT NULL,
    BLDCODE VARCHAR (64)  NOT NULL,
    BLDUNDAREA DECIMAL (15, 4)  NOT NULL,
    BLDCOST DECIMAL (15, 2)  NOT NULL,
    BLDQDNO VARCHAR (100)  NOT NULL
);

ALTER TABLE FDWBLD ADD
    CONSTRAINT PK_FDWBLD PRIMARY KEY
    (
        BLDID
    );

/******************************************
FDWHOU   房屋表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWHOU]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWHOU];
CREATE TABLE [dbo].[FDWHOU] (
    HOUID VARCHAR (32)  NOT NULL,
    HOUBLDID VARCHAR (32)  NOT NULL,
    HOUCELLNO VARCHAR (50)  NOT NULL,
    HOUROMNO VARCHAR (40)  NOT NULL,
    HOUNAME VARCHAR (80)  NOT NULL,
    HOUPERID VARCHAR (200)  NOT NULL,
    HOUAREA DECIMAL (15, 4)  NOT NULL,
    HOUMONEY DECIMAL (15, 2)  NOT NULL,
    HOUBUYDATE VARCHAR (8)  NOT NULL,
    HOUMANPAY DECIMAL (15, 2)  NOT NULL,
    HOUMANFACTPAY DECIMAL (15, 2)  NOT NULL,
    HOUREGDATE VARCHAR (8)  NOT NULL,
    HOUOPERUSR VARCHAR (32)  NOT NULL,
    HOUSTATUS VARCHAR (1)  NOT NULL,
    HOUREMARK VARCHAR (200)  NOT NULL,
    HOUCOST DECIMAL (15, 2)  NOT NULL,
    HOUCUSTOMNO VARCHAR (32)  NOT NULL,
    HOUACTCONTRFLG INT  NOT NULL,
    HOUROADNO VARCHAR (100)  NOT NULL,
    HOUPURPOSE VARCHAR (100)  NOT NULL,
    HOUTYPE VARCHAR (100)  NOT NULL,
    HOUSTRUCT VARCHAR (100)  NOT NULL,
    HOUFLOOR INT  NOT NULL,
    HOUPACTNO VARCHAR (60)  NOT NULL,
    HOUNUM VARCHAR (16)  NOT NULL,
    HOUQRYPWD VARCHAR (32)  NOT NULL,
    HOUFULLNUM VARCHAR (64)  NOT NULL,
    HOUVNDID VARCHAR (32)  NOT NULL,
    HOUVNDNAME VARCHAR (50)  NOT NULL,
    HOUKIND VARCHAR (100)  NOT NULL,
    HOUCHGYEAR VARCHAR (8)  NOT NULL,
    HOUTEL VARCHAR (32)  NOT NULL,
    HOUPAYBASE VARCHAR (32)  NOT NULL,
    HOUPAYPERPSN DECIMAL (9, 2)  NOT NULL,
    HOUDAILYPAYBASE VARCHAR (32)  NOT NULL,
    HOUDAILYPAYPERPSN DECIMAL (9, 2)  NOT NULL,
    HOUDAILYPAYMONEY DECIMAL (9, 2)  NOT NULL,
    HOUISCEARTACT VARCHAR (1)  NOT NULL,
    HOUHJNO VARCHAR (100)  NOT NULL
);

ALTER TABLE FDWHOU ADD
    CONSTRAINT PK_FDWHOU PRIMARY KEY
    (
        HOUID
    );

/******************************************
FDWMSD   物业主体缴交标准表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWMSD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWMSD];
CREATE TABLE [dbo].[FDWMSD] (
    MSDID VARCHAR (32)  NOT NULL,
    MSDMBDID VARCHAR (32)  NOT NULL,
    MSDMBDTYPE VARCHAR (32)  NOT NULL,
    MSDATKKIND VARCHAR (32)  NOT NULL,
    MSDPAYBASE VARCHAR (20)  NOT NULL,
    MSDPAYPERPSN DECIMAL (9, 2)  NOT NULL,
    MSDMANPAY DECIMAL (15, 2)  NOT NULL,
    MSDMANFACTPAY DECIMAL (15, 2)  NOT NULL
);

ALTER TABLE FDWMSD ADD
    CONSTRAINT PK_FDWMSD PRIMARY KEY
    (
        MSDID
    );

/******************************************
FDWPSD   缴交标准
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPSD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPSD];
CREATE TABLE [dbo].[FDWPSD] (
    PSDID VARCHAR (32)  NOT NULL,
    PSDACTKIND VARCHAR (32)  NOT NULL,
    PSDHOUKIND VARCHAR (100)  NOT NULL,
    PSDBLDTYPE VARCHAR (100)  NOT NULL,
    PSDBLDSTRUCT VARCHAR (100)  NOT NULL,
    PSDHOUPURPOSE VARCHAR (100)  NOT NULL,
    PSDPAYBASE VARCHAR (20)  NOT NULL,
    PSDPAYPERPSN DECIMAL (9, 2)  NOT NULL,
    PSDCOST DECIMAL (15, 2)  NOT NULL,
    PSDPAYMANDEC INT  NOT NULL,
    PSDPAYMANCARRY VARCHAR (100)  NOT NULL,
    PSDPAYPERCOMP DECIMAL (9, 2)  NOT NULL,
    PSDOPDATE VARCHAR (8)  NOT NULL,
    PSDOPTIME VARCHAR (6)  NOT NULL,
    PSDOPUSR VARCHAR (32)  NOT NULL,
    PSDREMARK VARCHAR (128)  NOT NULL
);

ALTER TABLE FDWPSD ADD
    CONSTRAINT PK_FDWPSD PRIMARY KEY
    (
        PSDID
    );

/******************************************
FDWACT   账户表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWACT]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWACT];
CREATE TABLE [dbo].[FDWACT] (
    ACTNO VARCHAR (32)  NOT NULL,
    ACTMBDTYPE VARCHAR (20)  NOT NULL,
    ACTMBDID VARCHAR (32)  NOT NULL,
    ACTKIND VARCHAR (32)  NOT NULL,
    ACTBNKID VARCHAR (32)  NOT NULL,
    ACTBNKACTNO VARCHAR (30)  NOT NULL,
    ACTPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    ACTPRINCIPALTOT DECIMAL (15, 2)  NOT NULL,
    ACTACCRUAL DECIMAL (15, 2)  NOT NULL,
    ACTACCRUALTOT DECIMAL (15, 2)  NOT NULL,
    ACTFROMONEY DECIMAL (15, 2)  NOT NULL,
    ACTPRINCICOMP DECIMAL (15, 2)  NOT NULL,
    ACTACCRUALCOMP DECIMAL (15, 2)  NOT NULL,
    ACTURGENTRUAL DECIMAL (15, 2)  NOT NULL,
    ACTURGENTRUALTOT DECIMAL (15, 2)  NOT NULL,
    ACTDEPDATE VARCHAR (8)  NOT NULL,
    ACTACCRUALNO VARCHAR (32)  NOT NULL,
    ACTSTATUS VARCHAR (1)  NOT NULL,
    ACTDESTROYDATE VARCHAR (8)  NOT NULL,
    ACTLSTACCRBAL DECIMAL (15, 2)  NOT NULL,
    ACTACCDATE VARCHAR (8)  NOT NULL,
    ACTSBADATE VARCHAR (8)  NOT NULL,
    ACTKEEPMONEY DECIMAL (15, 2)  NOT NULL
);

ALTER TABLE FDWACT ADD
    CONSTRAINT PK_FDWACT PRIMARY KEY
    (
        ACTNO
    );

/******************************************
FDWOAT   非中心账户表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWOAT]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWOAT];
CREATE TABLE [dbo].[FDWOAT] (
    OATNO VARCHAR (32)  NOT NULL,
    OATMBDTYPE VARCHAR (20)  NOT NULL,
    OATMBDID VARCHAR (32)  NOT NULL,
    OATKIND VARCHAR (32)  NOT NULL,
    OATPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    OATPRINCIPALTOT DECIMAL (15, 2)  NOT NULL,
    OATACCRUAL DECIMAL (15, 2)  NOT NULL,
    OATACCRUALTOT DECIMAL (15, 2)  NOT NULL,
    OATFROMONEY DECIMAL (15, 2)  NOT NULL,
    OATDEPDATE VARCHAR (8)  NOT NULL,
    OATSTATUS VARCHAR (1)  NOT NULL,
    OATDESTROYDATE VARCHAR (8)  NOT NULL,
    OATLSTACCRBAL DECIMAL (15, 2)  NOT NULL,
    OATACCDATE VARCHAR (8)  NOT NULL,
    OATWAITAMOUNT DECIMAL (15, 2)  NOT NULL
);

ALTER TABLE FDWOAT ADD
    CONSTRAINT PK_FDWOAT PRIMARY KEY
    (
        OATNO
    );

/******************************************
FDWACL   账户流水表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWACL]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWACL];
CREATE TABLE [dbo].[FDWACL] (
    ACLID VARCHAR (32)  NOT NULL,
    ACLACTNO VARCHAR (32)  NOT NULL,
    ACLPAYID VARCHAR (32)  NOT NULL,
    ACLTYPE VARCHAR (20)  NOT NULL,
    ACLDESC VARCHAR (200)  NOT NULL,
    ACLPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    ACLPRINCICOMP DECIMAL (15, 2)  NOT NULL,
    ACLACCRUAL DECIMAL (15, 2)  NOT NULL,
    ACLACCRUALCOMP DECIMAL (15, 2)  NOT NULL,
    ACLURGENTRUAL DECIMAL (15, 2)  NOT NULL,
    ACLACCDATE VARCHAR (8)  NOT NULL,
    ACLENTERDATE VARCHAR (8)  NOT NULL,
    ACLAPPOSTATUS VARCHAR (1)  NOT NULL,
    ACLREGFLG VARCHAR (1)  NOT NULL,
    ACLSTRIKEFLG VARCHAR (1)  NOT NULL,
    ACLREMARK VARCHAR (200)  NOT NULL,
    ACLPADNO VARCHAR (32)  NOT NULL,
    ACLCHKUSR VARCHAR (32)  NOT NULL,
    ACLFILENO VARCHAR (32)  NOT NULL
);

ALTER TABLE FDWACL ADD
    CONSTRAINT PK_FDWACL PRIMARY KEY
    (
        ACLID
    );

/******************************************
FDWPRP   维修资金预缴表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPRP]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPRP];
CREATE TABLE [dbo].[FDWPRP] (
    PRPID VARCHAR (32)  NOT NULL,
    PRPBDRID VARCHAR (32)  NOT NULL,
    PRPSRQID VARCHAR (32)  NOT NULL,
    PRPTYPE VARCHAR (1)  NOT NULL,
    PRPBDRNAME VARCHAR (100)  NOT NULL,
    PRPSRQNAME VARCHAR (100)  NOT NULL,
    PRPPRJNAME VARCHAR (100)  NOT NULL,
    PRPMONEY DECIMAL (15, 2)  NOT NULL,
    PRPLINKTEL VARCHAR (50)  NOT NULL,
    PRPLINKMAN VARCHAR (50)  NOT NULL,
    PRPSTATUS VARCHAR (1)  NOT NULL,
    PRPACCDATE VARCHAR (8)  NOT NULL,
    PRPYHSUSER VARCHAR (50)  NOT NULL,
    PRPYHSCOMPANY VARCHAR (100)  NOT NULL,
    PRPYHSDATE VARCHAR (8)  NOT NULL,
    PRPYHSTIME VARCHAR (6)  NOT NULL,
    PRPYHSCOMMENT VARCHAR (2000)  NOT NULL
);

ALTER TABLE FDWPRP ADD
    CONSTRAINT PK_FDWPRP PRIMARY KEY
    (
        PRPID
    );

/******************************************
FDWPRD   预缴抵扣表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPRD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPRD];
CREATE TABLE [dbo].[FDWPRD] (
    PRDID VARCHAR (32)  NOT NULL,
    PRDPATID VARCHAR (32)  NOT NULL,
    PRDPAYID VARCHAR (32)  NOT NULL,
    PRDMONEY DECIMAL (15, 2)  NOT NULL,
    PRDDATE VARCHAR (8)  NOT NULL,
    PRDSTATUS VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWPRD ADD
    CONSTRAINT PK_FDWPRD PRIMARY KEY
    (
        PRDID
    );

/******************************************
FDWPAT   维修资金预缴账户表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPAT]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPAT];
CREATE TABLE [dbo].[FDWPAT] (
    PATID VARCHAR (32)  NOT NULL,
    PATBDRID VARCHAR (32)  NOT NULL,
    PATSRQID VARCHAR (32)  NOT NULL,
    PATPRJNAME VARCHAR (50)  NOT NULL,
    PATSTATUS VARCHAR (1)  NOT NULL,
    PATREMAINTOT DECIMAL (15, 2)  NOT NULL,
    PATFROMONEY DECIMAL (15, 2)  NOT NULL,
    PATREMAIN DECIMAL (15, 2)  NOT NULL
);

ALTER TABLE FDWPAT ADD
    CONSTRAINT PK_FDWPAT PRIMARY KEY
    (
        PATID
    );

/******************************************
FDWPCL   维修资金预缴流水表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPCL]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPCL];
CREATE TABLE [dbo].[FDWPCL] (
    PCLID VARCHAR (32)  NOT NULL,
    PCLPATID VARCHAR (32)  NOT NULL,
    PCLMBDID VARCHAR (32)  NOT NULL,
    PCLTYPE VARCHAR (20)  NOT NULL,
    PCLMONEY DECIMAL (15, 2)  NOT NULL,
    PCLACCDATE VARCHAR (8)  NOT NULL,
    PCLRECUSR VARCHAR (20)  NOT NULL
);

ALTER TABLE FDWPCL ADD
    CONSTRAINT PK_FDWPCL PRIMARY KEY
    (
        PCLID
    );

/******************************************
FDWPHT   预缴原抵扣信息(无抵扣明细)
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPHT]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPHT];
CREATE TABLE [dbo].[FDWPHT] (
    PHTID VARCHAR (32)  NOT NULL,
    PHTPATID VARCHAR (32)  NOT NULL,
    PHTMONEY DECIMAL (15, 2)  NOT NULL,
    PHTDESC VARCHAR (100)  NOT NULL
);

ALTER TABLE FDWPHT ADD
    CONSTRAINT PK_FDWPHT PRIMARY KEY
    (
        PHTID
    );

/******************************************
FDWACC   系统结息记录表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWACC]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWACC];
CREATE TABLE [dbo].[FDWACC] (
    ACCID VARCHAR (32)  NOT NULL,
    ACCCALDATE VARCHAR (8)  NOT NULL,
    ACCSPACTMBDTYPE VARCHAR (50)  NOT NULL,
    ACCSPACTMBDID VARCHAR (32)  NOT NULL,
    ACCOPDATE VARCHAR (8)  NOT NULL,
    ACCRATE DECIMAL (9, 4)  NOT NULL,
    ACCRATE1 DECIMAL (9, 4)  NOT NULL,
    ACCVNDFIXRATE DECIMAL (9, 4)  NOT NULL,
    ACCACTRNG VARCHAR (512)  NOT NULL,
    ACCACTNUM INT  NOT NULL,
    ACCINIBAL DECIMAL (18, 2)  NOT NULL,
    ACCENDBAL DECIMAL (18, 2)  NOT NULL,
    ACCTOTALACTNUM INT  NOT NULL,
    ACCTOTALINIBAL DECIMAL (18, 2)  NOT NULL,
    ACCENDBALANCE DECIMAL (18, 2)  NOT NULL,
    ACCUSRNAME VARCHAR (32)  NOT NULL,
    ACCAMOUNT DECIMAL (18, 2)  NOT NULL,
    ACCPRODUCT DECIMAL (18, 2)  NOT NULL,
    ACCFACTACCR DECIMAL (18, 2)  NOT NULL,
    ACCEXP DECIMAL (18, 2)  NOT NULL,
    ACCACTAMOUNT DECIMAL (18, 2)  NOT NULL,
    ACCSTATUS INT  NOT NULL,
    ACCSACNUM INT  NOT NULL,
    ACCBIRID VARCHAR (32)  NOT NULL
);

ALTER TABLE FDWACC ADD
    CONSTRAINT PK_FDWACC PRIMARY KEY
    (
        ACCID
    );

/******************************************
FDWACQ   系统小区结息表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWACQ]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWACQ];
CREATE TABLE [dbo].[FDWACQ] (
    ACQACCID VARCHAR (32)  NOT NULL,
    ACQSRQID VARCHAR (32)  NOT NULL,
    ACQACTKIND VARCHAR (32)  NOT NULL,
    ACQACTNUM INT  NOT NULL,
    ACQAMOUNT DECIMAL (15, 2)  NOT NULL,
    ACQACTAMOUNT DECIMAL (15, 2)  NOT NULL,
    ACQEXP DECIMAL (15, 2)  NOT NULL,
    ACQINIBAL DECIMAL (15, 2)  NOT NULL,
    ACQCHGAMT DECIMAL (15, 2)  NOT NULL,
    ACQENDBAL DECIMAL (15, 2)  NOT NULL,
    ACQALLINIBAL DECIMAL (15, 2)  NOT NULL,
    ACQALLENDBAL DECIMAL (15, 2)  NOT NULL,
    ACQSTATUS INT  NOT NULL
);

ALTER TABLE FDWACQ ADD
    CONSTRAINT PK_FDWACQ PRIMARY KEY
    (
        ACQACCID,
        ACQSRQID,
        ACQACTKIND
    );

/******************************************
FDWACD   系统结息记录明细表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWACD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWACD];
CREATE TABLE [dbo].[FDWACD] (
    ACDACCID VARCHAR (32)  NOT NULL,
    ACDACTNO VARCHAR (32)  NOT NULL,
    ACDACTMBDTYPE VARCHAR (20)  NOT NULL,
    ACDACTKIND VARCHAR (32)  NOT NULL,
    ACDACTACCDATE VARCHAR (8)  NOT NULL,
    ACDAMOUNT DECIMAL (15, 2)  NOT NULL,
    ACDACTAMOUNT DECIMAL (15, 2)  NOT NULL,
    ACDEXP DECIMAL (15, 2)  NOT NULL,
    ACDINIBAL DECIMAL (15, 2)  NOT NULL,
    ACDCHGAMT DECIMAL (15, 2)  NOT NULL,
    ACDENDBAL DECIMAL (15, 2)  NOT NULL,
    ACDALLINIBAL DECIMAL (15, 2)  NOT NULL,
    ACDALLENDBAL DECIMAL (15, 2)  NOT NULL,
    ACDPRODUCT DECIMAL (15, 2)  NOT NULL,
    ACDRATE DECIMAL (9, 4)  NOT NULL
);

ALTER TABLE FDWACD ADD
    CONSTRAINT PK_FDWACD PRIMARY KEY
    (
        ACDACCID,
        ACDACTNO
    );

/******************************************
FDWADH   系统结息记录历史明细表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWADH]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWADH];
CREATE TABLE [dbo].[FDWADH] (
    ADHACCID VARCHAR (32)  NOT NULL,
    ADHACTNO VARCHAR (32)  NOT NULL,
    ADHACTMBDTYPE VARCHAR (20)  NOT NULL,
    ADHACTKIND VARCHAR (32)  NOT NULL,
    ADHACTACCDATE VARCHAR (8)  NOT NULL,
    ADHAMOUNT DECIMAL (15, 2)  NOT NULL,
    ADHACTAMOUNT DECIMAL (15, 2)  NOT NULL,
    ADHEXP DECIMAL (15, 2)  NOT NULL,
    ADHINIBAL DECIMAL (15, 2)  NOT NULL,
    ADHCHGAMT DECIMAL (15, 2)  NOT NULL,
    ADHENDBAL DECIMAL (15, 2)  NOT NULL,
    ADHALLINIBAL DECIMAL (15, 2)  NOT NULL,
    ADHALLENDBAL DECIMAL (15, 2)  NOT NULL,
    ADHPRODUCT DECIMAL (15, 2)  NOT NULL,
    ADHRATE DECIMAL (9, 4)  NOT NULL
);

ALTER TABLE FDWADH ADD
    CONSTRAINT PK_FDWADH PRIMARY KEY
    (
        ADHACCID,
        ADHACTNO
    );

/******************************************
FDWHCG   房屋变更信息表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWHCG]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWHCG];
CREATE TABLE [dbo].[FDWHCG] (
    HCGHOUID VARCHAR (32)  NOT NULL,
    HCGNO INT  NOT NULL,
    HCGOLDNAME VARCHAR (50)  NOT NULL,
    HCGOLDPERID VARCHAR (50)  NOT NULL,
    HCGNEWNAME VARCHAR (50)  NOT NULL,
    HCGNEWPERID VARCHAR (50)  NOT NULL,
    HCGOPERUSR VARCHAR (32)  NOT NULL,
    HCGOPERDATE VARCHAR (8)  NOT NULL,
    HCGREMARK VARCHAR (256)  NOT NULL,
    HCGCHKUSR VARCHAR (32)  NOT NULL,
    HCGCHKDATE VARCHAR (8)  NOT NULL,
    HCGSTATUS VARCHAR (1)  NOT NULL,
    HCGFILENO VARCHAR (32)  NOT NULL,
    HCGDATE VARCHAR (8)  NOT NULL,
    HCGOLDQRYPWD VARCHAR (32)  NOT NULL,
    HCGNEWQRYPWD VARCHAR (32)  NOT NULL
);

ALTER TABLE FDWHCG ADD
    CONSTRAINT PK_FDWHCG PRIMARY KEY
    (
        HCGHOUID,
        HCGNO
    );

/******************************************
FDWAPR   分摊记录表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWAPR]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWAPR];
CREATE TABLE [dbo].[FDWAPR] (
    APRID VARCHAR (32)  NOT NULL,
    APRTYPE VARCHAR (1)  NOT NULL,
    APRACTNO VARCHAR (32)  NOT NULL,
    APRACTMBDTYPE VARCHAR (20)  NOT NULL,
    APRACTMBDID VARCHAR (32)  NOT NULL,
    APRACTMBDDESC VARCHAR (100)  NOT NULL,
    APRBASE DECIMAL (15, 4)  NOT NULL,
    APRACTKIND VARCHAR (32)  NOT NULL,
    APRPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    APRPRINCIPALTOT DECIMAL (15, 2)  NOT NULL,
    APRACCRUAL DECIMAL (15, 2)  NOT NULL,
    APRACCRUALTOT DECIMAL (15, 2)  NOT NULL,
    APRSTATUS VARCHAR (10)  NOT NULL,
    APRUSR VARCHAR (32)  NOT NULL,
    APRDATE VARCHAR (8)  NOT NULL,
    APRCNCUSR VARCHAR (32)  NOT NULL,
    APRCNCDATE VARCHAR (8)  NOT NULL
);

ALTER TABLE FDWAPR ADD
    CONSTRAINT PK_FDWAPR PRIMARY KEY
    (
        APRID
    );

/******************************************
FDWAPT   摊出交易表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWAPT]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWAPT];
CREATE TABLE [dbo].[FDWAPT] (
    APTID VARCHAR (32)  NOT NULL,
    APTAPRID VARCHAR (32)  NOT NULL,
    APTACLID VARCHAR (32)  NOT NULL,
    APTPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    APTPRINCICOMP DECIMAL (15, 2)  NOT NULL,
    APTACCRUAL DECIMAL (15, 2)  NOT NULL,
    APTACCDATE VARCHAR (8)  NOT NULL,
    APTENTERDATE VARCHAR (8)  NOT NULL
);

ALTER TABLE FDWAPT ADD
    CONSTRAINT PK_FDWAPT PRIMARY KEY
    (
        APTID
    );

/******************************************
FDWAPD   摊入交易表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWAPD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWAPD];
CREATE TABLE [dbo].[FDWAPD] (
    APDID VARCHAR (32)  NOT NULL,
    APDAPTID VARCHAR (32)  NOT NULL,
    APDACTNO VARCHAR (32)  NOT NULL,
    APDACTMBDTYPE VARCHAR (20)  NOT NULL,
    APDACTMBDID VARCHAR (32)  NOT NULL,
    APDACTMBDDESC VARCHAR (250)  NOT NULL,
    APDBASE DECIMAL (15, 4)  NOT NULL,
    APDPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    APDPRINCICOMP DECIMAL (15, 2)  NOT NULL,
    APDACCRUAL DECIMAL (15, 2)  NOT NULL
);

ALTER TABLE FDWAPD ADD
    CONSTRAINT PK_FDWAPD PRIMARY KEY
    (
        APDID
    );

/******************************************
FDWWDR   物业信息导入表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWWDR]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWWDR];
CREATE TABLE [dbo].[FDWWDR] (
    WDRID VARCHAR (32)  NOT NULL,
    WDRSRQID VARCHAR (32)  NOT NULL,
    WDRMBDTYPE VARCHAR (32)  NOT NULL,
    WDRMBDID VARCHAR (32)  NOT NULL,
    WDRORIMBDTYPE VARCHAR (32)  NOT NULL,
    WDRORIMBDID VARCHAR (32)  NOT NULL,
    WDRBDRID VARCHAR (32)  NOT NULL,
    WDRTYPE VARCHAR (1)  NOT NULL,
    WDRSTATUS VARCHAR (1)  NOT NULL,
    WDRBATSERNO VARCHAR (30)  NOT NULL,
    WDRAPPPSN VARCHAR (20)  NOT NULL,
    WDRAPPLINKTEL VARCHAR (50)  NOT NULL,
    WDRYHSUSER VARCHAR (50)  NOT NULL,
    WDRYHSCOMPANY VARCHAR (100)  NOT NULL,
    WDRYHSDATE VARCHAR (8)  NOT NULL,
    WDRYHSTIME VARCHAR (6)  NOT NULL,
    WDRYHSCOMMENT VARCHAR (2000)  NOT NULL
);

ALTER TABLE FDWWDR ADD
    CONSTRAINT PK_FDWWDR PRIMARY KEY
    (
        WDRID
    );

/******************************************
FDWWDM   物业导入明细表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWWDM]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWWDM];
CREATE TABLE [dbo].[FDWWDM] (
    WDMID VARCHAR (32)  NOT NULL,
    WDMMBDID VARCHAR (32)  NOT NULL,
    WDMBLDNO VARCHAR (32)  NOT NULL,
    WDMBLDSTRUCT VARCHAR (100)  NOT NULL,
    WDMBLDFNSDATE VARCHAR (8)  NOT NULL,
    WDMBLDAREA DECIMAL (15, 4)  NOT NULL,
    WDMBLDREMARK VARCHAR (200)  NOT NULL,
    WDMBLDTYPE VARCHAR (100)  NOT NULL,
    WDMBLDPURPOSE VARCHAR (100)  NOT NULL,
    WDMBLDFLOORNUM INT  NOT NULL,
    WDMBLDKIND VARCHAR (32)  NOT NULL,
    WDMBLDROOMNUM INT  NOT NULL,
    WDMBLDID VARCHAR (32)  NOT NULL,
    WDMPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    WDMACCRUAL DECIMAL (15, 2)  NOT NULL,
    WDMBLDQDNO VARCHAR (100)  NOT NULL
);

ALTER TABLE FDWWDM ADD
    CONSTRAINT PK_FDWWDM PRIMARY KEY
    (
        WDMID
    );

/******************************************
FDWWHM   物业导入房屋明细表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWWHM]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWWHM];
CREATE TABLE [dbo].[FDWWHM] (
    WHMID VARCHAR (32)  NOT NULL,
    WHMMBDID VARCHAR (32)  NOT NULL,
    WHMBLDID VARCHAR (32)  NOT NULL,
    WHMBLDNO VARCHAR (100)  NOT NULL,
    WHMHOUCELLNO VARCHAR (50)  NOT NULL,
    WHMHOUROMNO VARCHAR (40)  NOT NULL,
    WHMHOUNAME VARCHAR (80)  NOT NULL,
    WHMHOUPERID VARCHAR (100)  NOT NULL,
    WHMHOUAREA DECIMAL (15, 4)  NOT NULL,
    WHMHOUDAILYPAYBASE VARCHAR (20)  NOT NULL,
    WHMHOUDAILYPAYPERPSN DECIMAL (9, 2)  NOT NULL,
    WHMHOUROADNO VARCHAR (50)  NOT NULL,
    WHMHOUFLOOR INT  NOT NULL,
    WHMHOUMONEY DECIMAL (15, 2)  NOT NULL,
    WHMHOUREMARK VARCHAR (200)  NOT NULL,
    WHMHOUKIND VARCHAR (50)  NOT NULL,
    WHMHOUPURPOSE VARCHAR (100)  NOT NULL,
    WHMHOUTYPE VARCHAR (100)  NOT NULL,
    WHMHOUSTRUCT VARCHAR (100)  NOT NULL,
    WHMHOUID VARCHAR (32)  NOT NULL,
    WHMPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    WHMACCRUAL DECIMAL (15, 2)  NOT NULL,
    WHMTEL VARCHAR (32)  NOT NULL,
    WHMISCEARTACT VARCHAR (1)  NOT NULL,
    WHMHOUHJNO VARCHAR (100)  NOT NULL
);

ALTER TABLE FDWWHM ADD
    CONSTRAINT PK_FDWWHM PRIMARY KEY
    (
        WHMID
    );

/******************************************
FDWDPD   各类资金业务收入明细表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWDPD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWDPD];
CREATE TABLE [dbo].[FDWDPD] (
    DPDID VARCHAR (32)  NOT NULL,
    DPDMBDID VARCHAR (100)  NOT NULL,
    DPDACTNO VARCHAR (32)  NOT NULL,
    DPDACTMBDID VARCHAR (32)  NOT NULL,
    DPDACTMBDTYPE VARCHAR (32)  NOT NULL,
    DPDPAYABLEAMOUNT DECIMAL (15, 2)  NOT NULL,
    DPDPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    DPDACCRUAL DECIMAL (15, 2)  NOT NULL,
    DPDBILDOCNUM VARCHAR (10)  NOT NULL,
    DPDBILDOCNO VARCHAR (10)  NOT NULL,
    DPDVCHIDPSN VARCHAR (32)  NOT NULL,
    DPDVCHIDUNIT VARCHAR (32)  NOT NULL,
    DPDSTRMOUTH VARCHAR (6)  NOT NULL,
    DPDENDMOUTH VARCHAR (6)  NOT NULL
);

ALTER TABLE FDWDPD ADD
    CONSTRAINT PK_FDWDPD PRIMARY KEY
    (
        DPDID
    );

/******************************************
FDWDLD   各类资金业务支出明细表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWDLD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWDLD];
CREATE TABLE [dbo].[FDWDLD] (
    DLDID VARCHAR (32)  NOT NULL,
    DLDMBDID VARCHAR (100)  NOT NULL,
    DLDACTNO VARCHAR (32)  NOT NULL,
    DLDAPPAMT DECIMAL (15, 2)  NOT NULL,
    DLDAUTHAMT DECIMAL (15, 2)  NOT NULL,
    DLDSYSAMT DECIMAL (15, 2)  NOT NULL,
    DLDAUTHAMTTRN DECIMAL (15, 2)  NOT NULL,
    DLDSYSAMTTRN DECIMAL (15, 2)  NOT NULL,
    DLDACTLASTBAL DECIMAL (15, 2)  NOT NULL,
    DLDACTLASTACC DECIMAL (15, 2)  NOT NULL,
    DLDACTLASTUSB DECIMAL (15, 2)  NOT NULL,
    DLDACTRETION DECIMAL (15, 2)  NOT NULL,
    DLDSERNO INT  NOT NULL,
    DLDADDAPPAMT DECIMAL (15, 2)  NOT NULL,
    DLDADDAUTHAMT DECIMAL (15, 2)  NOT NULL,
    DLDADDSYSAMT DECIMAL (15, 2)  NOT NULL,
    DLDFILLACC DECIMAL (15, 2)  NOT NULL,
    DLDVOTE VARCHAR (32)  NOT NULL,
    DLDVOTEVALID VARCHAR (1)  NOT NULL,
    DLDUNALLOCAT DECIMAL (15, 2)  NOT NULL,
    DLDFROMONEY DECIMAL (15, 2)  NOT NULL,
    DLDSUBFROMONEY DECIMAL (15, 2)  NOT NULL,
    DLDBNKNAME VARCHAR (100)  NOT NULL,
    DLDBNKNO VARCHAR (100)  NOT NULL,
    DLDBNKACTNAME VARCHAR (100)  NOT NULL,
    DLDHOUOWNER VARCHAR (150)  NOT NULL,
    DLDREMARK VARCHAR (250)  NOT NULL
);

ALTER TABLE FDWDLD ADD
    CONSTRAINT PK_FDWDLD PRIMARY KEY
    (
        DLDID
    );

/******************************************
FDWTRF   各类资金业务支出划拨表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWTRF]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWTRF];
CREATE TABLE [dbo].[FDWTRF] (
    TRFID VARCHAR (32)  NOT NULL,
    TRFCAUID VARCHAR (32)  NOT NULL,
    TRFOUTID VARCHAR (32)  NOT NULL,
    TRFMBDID VARCHAR (32)  NOT NULL,
    TRFMBDNAME VARCHAR (200)  NOT NULL,
    TRFINITMBDNAME VARCHAR (200)  NOT NULL,
    TRFNAME VARCHAR (200)  NOT NULL,
    TRFRECEMBDID VARCHAR (32)  NOT NULL,
    TRFRECEMBDTYPE VARCHAR (50)  NOT NULL,
    TRFATKKIND VARCHAR (32)  NOT NULL,
    TRFNO INT  NOT NULL,
    TRFISEND VARCHAR (1)  NOT NULL,
    TRFDATE VARCHAR (8)  NOT NULL,
    TRFAPPAMT DECIMAL (15, 2)  NOT NULL,
    TRFAMT DECIMAL (15, 2)  NOT NULL,
    TRFSYSAMT DECIMAL (15, 2)  NOT NULL,
    TRFBNKMONEY DECIMAL (9, 2)  NOT NULL,
    TRFBILL VARCHAR (50)  NOT NULL,
    TRFCHECKINF VARCHAR (300)  NOT NULL,
    TRFSTATUS VARCHAR (1)  NOT NULL,
    TRFDATASTATUS VARCHAR (1)  NOT NULL,
    TRFMBDSTATUS VARCHAR (1)  NOT NULL,
    TRFBNKID VARCHAR (32)  NOT NULL,
    TRFFILENO VARCHAR (32)  NOT NULL,
    TRFYHSUSER VARCHAR (50)  NOT NULL,
    TRFYHSCOMPANY VARCHAR (100)  NOT NULL,
    TRFYHSDATE VARCHAR (8)  NOT NULL,
    TRFYHSTIME VARCHAR (6)  NOT NULL,
    TRFYHSCOMMENT VARCHAR (2000)  NOT NULL,
    TRFCWSBPRINT VARCHAR (1)  NOT NULL,
    TRFCAUSTATUS VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWTRF ADD
    CONSTRAINT PK_FDWTRF PRIMARY KEY
    (
        TRFID
    );

/******************************************
FDWTRN   各类资金业务支出划拨流水表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWTRN]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWTRN];
CREATE TABLE [dbo].[FDWTRN] (
    TRNID VARCHAR (32)  NOT NULL,
    TRNTRFID VARCHAR (32)  NOT NULL,
    TRNMBDID VARCHAR (32)  NOT NULL,
    TRNATKKIND VARCHAR (32)  NOT NULL,
    TRNNO INT  NOT NULL,
    TRNDATE VARCHAR (8)  NOT NULL,
    TRNAPPAMT DECIMAL (15, 2)  NOT NULL,
    TRNAMT DECIMAL (15, 2)  NOT NULL,
    TRNSYSAMT DECIMAL (15, 2)  NOT NULL,
    TRNBILL VARCHAR (50)  NOT NULL,
    TRNSTATUS VARCHAR (1)  NOT NULL,
    TRNBNKID VARCHAR (32)  NOT NULL,
    TRNFILENO VARCHAR (32)  NOT NULL,
    TRNYHSUSER VARCHAR (50)  NOT NULL,
    TRNYHSCOMPANY VARCHAR (100)  NOT NULL,
    TRNYHSDATE VARCHAR (8)  NOT NULL,
    TRNYHSTIME VARCHAR (6)  NOT NULL,
    TRNYHSCOMMENT VARCHAR (2000)  NOT NULL
);

ALTER TABLE FDWTRN ADD
    CONSTRAINT PK_FDWTRN PRIMARY KEY
    (
        TRNID
    );

/******************************************
FDWTRD   各类资金业务支出划拨流水明细表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWTRD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWTRD];
CREATE TABLE [dbo].[FDWTRD] (
    TRDTRNID VARCHAR (32)  NOT NULL,
    TRDACTNO VARCHAR (32)  NOT NULL,
    TRDSERNO INT  NOT NULL,
    TRDAUTHAMT DECIMAL (15, 2)  NOT NULL,
    TRDSYSAMT DECIMAL (15, 2)  NOT NULL,
    TRDCASHDEAL VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWTRD ADD
    CONSTRAINT PK_FDWTRD PRIMARY KEY
    (
        TRDTRNID,
        TRDACTNO
    );

/******************************************
FDWTRB   各类资金业务支出退还表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWTRB]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWTRB];
CREATE TABLE [dbo].[FDWTRB] (
    TRBID VARCHAR (32)  NOT NULL,
    TRBNO VARCHAR (32)  NOT NULL,
    TRBNAME VARCHAR (200)  NOT NULL,
    TRBMBDTYPE VARCHAR (20)  NOT NULL,
    TRBMBDID VARCHAR (32)  NOT NULL,
    TRBMBDNAME VARCHAR (100)  NOT NULL,
    TRBORIMBDTYPE VARCHAR (32)  NOT NULL,
    TRBORIMBDID VARCHAR (32)  NOT NULL,
    TRBOUTMBDID VARCHAR (32)  NOT NULL,
    TRBMODE VARCHAR (10)  NOT NULL,
    TRBSRQID VARCHAR (32)  NOT NULL,
    TRBSTATUS VARCHAR (1)  NOT NULL,
    TRBCHECKNO VARCHAR (15)  NOT NULL,
    TRBABLEAMOUNT DECIMAL (15, 2)  NOT NULL,
    TRBPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    TRBACCRUAL DECIMAL (15, 2)  NOT NULL,
    TRBPROPER VARCHAR (20)  NOT NULL,
    TRBTYPE VARCHAR (20)  NOT NULL,
    TRBDETNUM INT  NOT NULL,
    TRBACCDATE VARCHAR (8)  NOT NULL,
    TRBBNKID VARCHAR (32)  NOT NULL,
    TRBREMARK VARCHAR (200)  NOT NULL,
    TRBRELMAN VARCHAR (20)  NOT NULL,
    TRBRELTEL VARCHAR (20)  NOT NULL,
    TRBAREA DECIMAL (15, 4)  NOT NULL,
    TRBFILENO VARCHAR (32)  NOT NULL,
    TRBYHSPROMISEDATE VARCHAR (8)  NOT NULL,
    TRBYHSDEMANDDATE VARCHAR (8)  NOT NULL,
    TRBYHSPAUSEDATE VARCHAR (8)  NOT NULL,
    TRBYHSUSER VARCHAR (50)  NOT NULL,
    TRBYHSCOMPANY VARCHAR (100)  NOT NULL,
    TRBYHSDATE VARCHAR (8)  NOT NULL,
    TRBYHSTIME VARCHAR (6)  NOT NULL,
    TRBYHSCOMMENT VARCHAR (2000)  NOT NULL,
    TRBDATASTATUS VARCHAR (1)  NOT NULL,
    TRBFLOW VARCHAR (20)  NOT NULL
);

ALTER TABLE FDWTRB ADD
    CONSTRAINT PK_FDWTRB PRIMARY KEY
    (
        TRBID
    );

/******************************************
FDWDBD   各类资金业务决算表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWDBD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWDBD];
CREATE TABLE [dbo].[FDWDBD] (
    DBDID VARCHAR (32)  NOT NULL,
    DBDMBDID VARCHAR (32)  NOT NULL,
    DBDATKKIND VARCHAR (32)  NOT NULL,
    DBDBUDGETAMT DECIMAL (15, 2)  NOT NULL,
    DBDAPPAMT DECIMAL (15, 2)  NOT NULL,
    DBDAUDPRICE DECIMAL (15, 2)  NOT NULL,
    DBDAUTHAMT DECIMAL (15, 2)  NOT NULL,
    DBDSTATUS VARCHAR (1)  NOT NULL,
    DBDDATE VARCHAR (8)  NOT NULL,
    DBDDESC VARCHAR (300)  NOT NULL
);

ALTER TABLE FDWDBD ADD
    CONSTRAINT PK_FDWDBD PRIMARY KEY
    (
        DBDID
    );

/******************************************
FDWPAY   维修资金缴款表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPAY]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPAY];
CREATE TABLE [dbo].[FDWPAY] (
    PAYID VARCHAR (32)  NOT NULL,
    PAYNO VARCHAR (32)  NOT NULL,
    PAYNAME VARCHAR (200)  NOT NULL,
    PAYMBDTYPE VARCHAR (20)  NOT NULL,
    PAYMBDID VARCHAR (32)  NOT NULL,
    PAYMBDNAME VARCHAR (100)  NOT NULL,
    PAYORIMBDTYPE VARCHAR (32)  NOT NULL,
    PAYORIMBDID VARCHAR (32)  NOT NULL,
    PAYMODE VARCHAR (10)  NOT NULL,
    PAYSRQID VARCHAR (32)  NOT NULL,
    PAYSTATUS VARCHAR (1)  NOT NULL,
    PAYCHECKNO VARCHAR (15)  NOT NULL,
    PAYABLEAMOUNT DECIMAL (15, 2)  NOT NULL,
    PAYPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    PAYACCRUAL DECIMAL (15, 2)  NOT NULL,
    PAYQUTMONEY DECIMAL (15, 2)  NOT NULL,
    PAYPROPER VARCHAR (20)  NOT NULL,
    PAYDETNUM INT  NOT NULL,
    PAYENTERFLG VARCHAR (1)  NOT NULL,
    PAYACCDATE VARCHAR (8)  NOT NULL,
    PAYBATPROFLG VARCHAR (1)  NOT NULL,
    PAYBNKID VARCHAR (32)  NOT NULL,
    PAYREMARK VARCHAR (200)  NOT NULL,
    PAYBILDOCNUM VARCHAR (10)  NOT NULL,
    PAYBILDOCNO VARCHAR (20)  NOT NULL,
    PAYVCHID VARCHAR (32)  NOT NULL,
    PAYRELMAN VARCHAR (20)  NOT NULL,
    PAYRELTEL VARCHAR (20)  NOT NULL,
    PAYTYPE VARCHAR (20)  NOT NULL,
    PAYACRFLG VARCHAR (1)  NOT NULL,
    PAYNEWMBDFLG VARCHAR (1)  NOT NULL,
    PAYBATSERNO VARCHAR (30)  NOT NULL,
    PAYREALAMT DECIMAL (15, 2)  NOT NULL,
    PAYANLMODE VARCHAR (1)  NOT NULL,
    PAYREPOSE VARCHAR (200)  NOT NULL,
    PAYAREA DECIMAL (15, 4)  NOT NULL,
    PAYMONEY DECIMAL (15, 2)  NOT NULL,
    PAYMAN VARCHAR (50)  NOT NULL,
    PAYHPBID VARCHAR (32)  NOT NULL,
    PAYINFODESC VARCHAR (100)  NOT NULL,
    PAYPRINCICOMP DECIMAL (15, 2)  NOT NULL,
    PAYFILENO VARCHAR (32)  NOT NULL,
    PAYYHSPROMISEDATE VARCHAR (8)  NOT NULL,
    PAYYHSDEMANDDATE VARCHAR (8)  NOT NULL,
    PAYYHSPAUSEDATE VARCHAR (8)  NOT NULL,
    PAYYHSUSER VARCHAR (50)  NOT NULL,
    PAYYHSCOMPANY VARCHAR (100)  NOT NULL,
    PAYYHSDATE VARCHAR (8)  NOT NULL,
    PAYYHSTIME VARCHAR (6)  NOT NULL,
    PAYYHSCOMMENT VARCHAR (2000)  NOT NULL,
    PAYDATASTATUS VARCHAR (1)  NOT NULL,
    PAYFLOW VARCHAR (20)  NOT NULL
);

ALTER TABLE FDWPAY ADD
    CONSTRAINT PK_FDWPAY PRIMARY KEY
    (
        PAYID
    );

/******************************************
FDWFAR   维修资金使用表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWFAR]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWFAR];
CREATE TABLE [dbo].[FDWFAR] (
    FARID VARCHAR (32)  NOT NULL,
    FARNO VARCHAR (32)  NOT NULL,
    FARMBDTYPE VARCHAR (32)  NOT NULL,
    FARMBDID VARCHAR (32)  NOT NULL,
    FARMBDNAME VARCHAR (100)  NOT NULL,
    FARORIMBDTYPE VARCHAR (32)  NOT NULL,
    FARORIMBDID VARCHAR (32)  NOT NULL,
    FARSRQID VARCHAR (32)  NOT NULL,
    FARITMNAME VARCHAR (150)  NOT NULL,
    FARTYPE VARCHAR (1)  NOT NULL,
    FARDAMAGEDESC TEXT  NOT NULL,
    FARREPAIRSCHEME TEXT  NOT NULL,
    FARTRFTYPE VARCHAR (1)  NOT NULL,
    FAROUTMODE VARCHAR (1)  NOT NULL,
    FARBUDGETAMT DECIMAL (15, 2)  NOT NULL,
    FARAPPAMT DECIMAL (15, 2)  NOT NULL,
    FARCOMPACTAMT DECIMAL (15, 2)  NOT NULL,
    FARAUTHAMT DECIMAL (15, 2)  NOT NULL,
    FARSYSAMT DECIMAL (15, 2)  NOT NULL,
    FARTRNAMT DECIMAL (15, 2)  NOT NULL,
    FARAUD VARCHAR (1)  NOT NULL,
    FARAUTDESC VARCHAR (300)  NOT NULL,
    FARISAUD VARCHAR (1)  NOT NULL,
    FARISAPPAUD VARCHAR (1)  NOT NULL,
    FARAUDID VARCHAR (32)  NOT NULL,
    FARAUDPRICE DECIMAL (15, 2)  NOT NULL,
    FARAPPAUDTYPE VARCHAR (64)  NOT NULL,
    FARAPPAUDDESC VARCHAR (300)  NOT NULL,
    FARADDAPPAMT DECIMAL (15, 2)  NOT NULL,
    FARADDAUTHAMT DECIMAL (15, 2)  NOT NULL,
    FARADDSYSAMT DECIMAL (15, 2)  NOT NULL,
    FARADDAUD VARCHAR (1)  NOT NULL,
    FARADDISAUD VARCHAR (1)  NOT NULL,
    FARADDAUDPRICE DECIMAL (15, 2)  NOT NULL,
    FARAUTHAMTTRN DECIMAL (15, 2)  NOT NULL,
    FARSYSAMTTRN DECIMAL (15, 2)  NOT NULL,
    FARREATYPE VARCHAR (64)  NOT NULL,
    FARREASON VARCHAR (300)  NOT NULL,
    FARAPPLINK VARCHAR (100)  NOT NULL,
    FARAPPLINKTEL VARCHAR (50)  NOT NULL,
    FARAPPLINKJOB VARCHAR (200)  NOT NULL,
    FARAPPLINKPHONE VARCHAR (50)  NOT NULL,
    FARSTATUS VARCHAR (1)  NOT NULL,
    FARREMARK VARCHAR (200)  NOT NULL,
    FARYHSPROMISEDATE VARCHAR (8)  NOT NULL,
    FARYHSDEMANDDATE VARCHAR (8)  NOT NULL,
    FARYHSPAUSEDATE VARCHAR (8)  NOT NULL,
    FARYHSUSER VARCHAR (50)  NOT NULL,
    FARYHSCOMPANY VARCHAR (100)  NOT NULL,
    FARYHSDATE VARCHAR (8)  NOT NULL,
    FARYHSTIME VARCHAR (6)  NOT NULL,
    FARYHSCOMMENT VARCHAR (2000)  NOT NULL,
    FARDATASTATUS VARCHAR (1)  NOT NULL,
    FARSTRING1 VARCHAR (500)  NOT NULL,
    FARSTRING2 VARCHAR (500)  NOT NULL,
    FARAPPPSNF VARCHAR (20)  NOT NULL,
    FARAPPLINKPHONEF VARCHAR (50)  NOT NULL,
    FARAPPPSNE VARCHAR (20)  NOT NULL,
    FARAPPLINKPHONEE VARCHAR (50)  NOT NULL,
    FARAMAREMARKS VARCHAR (200)  NOT NULL,
    FARXCKCCZENDDATE VARCHAR (8)  NOT NULL,
    FARSJCZENDDATE VARCHAR (8)  NOT NULL,
    FARSQKHBCZENDDATE VARCHAR (8)  NOT NULL
);

ALTER TABLE FDWFAR ADD
    CONSTRAINT PK_FDWFAR PRIMARY KEY
    (
        FARID
    );

/******************************************
FDWPLY   维修资金使用子项目表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPLY]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPLY];
CREATE TABLE [dbo].[FDWPLY] (
    PLYID VARCHAR (32)  NOT NULL,
    PLYFARID VARCHAR (32)  NOT NULL,
    PLYKIND VARCHAR (10)  NOT NULL,
    PLYTYPE VARCHAR (10)  NOT NULL,
    PLYMBDTYPE VARCHAR (20)  NOT NULL,
    PLYMBDID VARCHAR (32)  NOT NULL,
    PLYMBDNAME VARCHAR (100)  NOT NULL,
    PLYITMNAME VARCHAR (150)  NOT NULL,
    PLYSRQID VARCHAR (32)  NOT NULL,
    PLYPCTID VARCHAR (32)  NOT NULL,
    PLYAPPOBJDESC VARCHAR (400)  NOT NULL,
    PLYBUDGETAMT DECIMAL (15, 2)  NOT NULL,
    PLYAPPAMT DECIMAL (15, 2)  NOT NULL,
    PLYAUDPRICE DECIMAL (15, 2)  NOT NULL,
    PLYCOMPACTAMT DECIMAL (15, 2)  NOT NULL,
    PLYAUTHAMT DECIMAL (15, 2)  NOT NULL,
    PLYSYSAMT DECIMAL (15, 2)  NOT NULL,
    PLYTRNDATE VARCHAR (8)  NOT NULL,
    PLYTRNAMT DECIMAL (15, 2)  NOT NULL,
    PLYADDAPPAMT DECIMAL (15, 2)  NOT NULL,
    PLYADDAUTHAMT DECIMAL (15, 2)  NOT NULL,
    PLYADDSYSAMT DECIMAL (15, 2)  NOT NULL,
    PLYADDAUDPRICE DECIMAL (15, 2)  NOT NULL,
    PLYAUTHAMTTRN DECIMAL (15, 2)  NOT NULL,
    PLYSYSAMTTRN DECIMAL (15, 2)  NOT NULL,
    PLYCSOID VARCHAR (32)  NOT NULL,
    PLYCONSTRUCTION VARCHAR (100)  NOT NULL,
    PLYDESIGN VARCHAR (100)  NOT NULL,
    PLYSUPERVISION VARCHAR (100)  NOT NULL,
    PLYDTLNUM INT  NOT NULL,
    PLYAREA DECIMAL (15, 2)  NOT NULL,
    PLYAPPPSN VARCHAR (20)  NOT NULL,
    PLYAPPPERID VARCHAR (30)  NOT NULL,
    PLYAPPLINKTEL VARCHAR (50)  NOT NULL,
    PLYAPPBNKANDACT VARCHAR (50)  NOT NULL,
    PLYSTATUS VARCHAR (1)  NOT NULL,
    PLYCOMMENT VARCHAR (200)  NOT NULL,
    PLYADDRESS VARCHAR (200)  NOT NULL,
    PLYOUTMODE VARCHAR (1)  NOT NULL,
    PLYAPPMODE VARCHAR (20)  NOT NULL,
    PLYVOTEDESC VARCHAR (1000)  NOT NULL,
    PLYVOTENUM INT  NOT NULL,
    PLYAGREEHOUSUM INT  NOT NULL,
    PLYAGREEAREASUM DECIMAL (9, 2)  NOT NULL,
    PLYFILENO VARCHAR (32)  NOT NULL,
    PLYYHSPROMISEDATE VARCHAR (8)  NOT NULL,
    PLYYHSDEMANDDATE VARCHAR (8)  NOT NULL,
    PLYYHSPAUSEDATE VARCHAR (8)  NOT NULL,
    PLYYHSUSER VARCHAR (50)  NOT NULL,
    PLYYHSCOMPANY VARCHAR (100)  NOT NULL,
    PLYYHSDATE VARCHAR (8)  NOT NULL,
    PLYYHSTIME VARCHAR (6)  NOT NULL,
    PLYYHSCOMMENT VARCHAR (2000)  NOT NULL,
    PLYDATASTATUS VARCHAR (1)  NOT NULL,
    PLYWARRANTY INT  NOT NULL
);

ALTER TABLE FDWPLY ADD
    CONSTRAINT PK_FDWPLY PRIMARY KEY
    (
        PLYID
    );

/******************************************
FDWRFD   各类资金退款表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWRFD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWRFD];
CREATE TABLE [dbo].[FDWRFD] (
    RFDID VARCHAR (32)  NOT NULL,
    RFDNO VARCHAR (32)  NOT NULL,
    RFDATKKIND VARCHAR (32)  NOT NULL,
    RFDTYPE VARCHAR (20)  NOT NULL,
    RFDOUTID VARCHAR (32)  NOT NULL,
    RFDNAME VARCHAR (200)  NOT NULL,
    RFDRANGEDESC VARCHAR (1000)  NOT NULL,
    RFDMBDTYPE VARCHAR (20)  NOT NULL,
    RFDMBDID VARCHAR (32)  NOT NULL,
    RFDMBDNAME VARCHAR (100)  NOT NULL,
    RFDORIMBDTYPE VARCHAR (32)  NOT NULL,
    RFDORIMBDID VARCHAR (32)  NOT NULL,
    RFDSRQID VARCHAR (32)  NOT NULL,
    RFDLOGOUT VARCHAR (1)  NOT NULL,
    RFDSTATUS VARCHAR (1)  NOT NULL,
    RFDPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    RFDACCRUAL DECIMAL (15, 2)  NOT NULL,
    RFDACCDATE VARCHAR (8)  NOT NULL,
    RFDLINKMAN VARCHAR (20)  NOT NULL,
    RFDLINKTEL VARCHAR (50)  NOT NULL,
    RFDLINKJOB VARCHAR (200)  NOT NULL,
    RFDLINKPHONE VARCHAR (50)  NOT NULL,
    RFDBNKNAME VARCHAR (100)  NOT NULL,
    RFDBNKNO VARCHAR (100)  NOT NULL,
    RFDBNKACTNAME VARCHAR (100)  NOT NULL,
    RFDREMARK VARCHAR (200)  NOT NULL,
    RFDYHSUSER VARCHAR (50)  NOT NULL,
    RFDYHSCOMPANY VARCHAR (100)  NOT NULL,
    RFDYHSDATE VARCHAR (8)  NOT NULL,
    RFDYHSTIME VARCHAR (6)  NOT NULL,
    RFDYHSCOMMENT VARCHAR (2000)  NOT NULL,
    RFDDATASTATUS VARCHAR (1)  NOT NULL,
    RFDCQTYPE VARCHAR (1)  NOT NULL,
    RFDCQNAME VARCHAR (100)  NOT NULL,
    RFDCQCORP VARCHAR (50)  NOT NULL,
    RFDCQCORPPHONE VARCHAR (50)  NOT NULL,
    RFDCQCORPPERID VARCHAR (50)  NOT NULL,
    RFDCQPHONE VARCHAR (50)  NOT NULL,
    RFDCQPERID VARCHAR (50)  NOT NULL,
    RFDAPPPSN VARCHAR (50)  NOT NULL,
    RFDAPPLINKTEL VARCHAR (50)  NOT NULL,
    RFDAPPPERID VARCHAR (50)  NOT NULL,
    RFDACCEPTDATE VARCHAR (8)  NOT NULL,
    RFDTAKEDATE VARCHAR (8)  NOT NULL,
    RFDAMAREMARKS VARCHAR (200)  NOT NULL,
    RFDYHSPAUSEDATE VARCHAR (8)  NOT NULL,
    RFDFLOW VARCHAR (20)  NOT NULL,
    RFDYHSPROMISEDATE VARCHAR (8)  NOT NULL,
    RFDYHSDEMANDDATE VARCHAR (8)  NOT NULL,
    RFDLOGACCRUAL DECIMAL (15, 2)  NOT NULL,
    RFDLOGDATE VARCHAR (8)  NOT NULL
);

ALTER TABLE FDWRFD ADD
    CONSTRAINT PK_FDWRFD PRIMARY KEY
    (
        RFDID
    );

/******************************************
FDWDPY   日常资金缴款表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWDPY]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWDPY];
CREATE TABLE [dbo].[FDWDPY] (
    DPYID VARCHAR (32)  NOT NULL,
    DPYNO VARCHAR (32)  NOT NULL,
    DPYPAVID VARCHAR (32)  NOT NULL,
    DPYSRQID VARCHAR (32)  NOT NULL,
    DPYMBDTYPE VARCHAR (20)  NOT NULL,
    DPYMBDID VARCHAR (32)  NOT NULL,
    DPYMBDNAME VARCHAR (100)  NOT NULL,
    DPYMODE VARCHAR (10)  NOT NULL,
    DPYSTATUS VARCHAR (1)  NOT NULL,
    DPYPAYABLEAMOUNT DECIMAL (15, 2)  NOT NULL,
    DPYACTUALAMOUNT DECIMAL (15, 2)  NOT NULL,
    DPYSTRMOUTH VARCHAR (6)  NOT NULL,
    DPYENDMOUTH VARCHAR (6)  NOT NULL,
    DPYACCDATE VARCHAR (8)  NOT NULL,
    DPYREMARK VARCHAR (200)  NOT NULL,
    DPYYHSPROMISEDATE VARCHAR (8)  NOT NULL,
    DPYYHSDEMANDDATE VARCHAR (8)  NOT NULL,
    DPYYHSPAUSEDATE VARCHAR (8)  NOT NULL,
    DPYYHSUSER VARCHAR (50)  NOT NULL,
    DPYYHSCOMPANY VARCHAR (100)  NOT NULL,
    DPYYHSDATE VARCHAR (8)  NOT NULL,
    DPYYHSTIME VARCHAR (6)  NOT NULL,
    DPYYHSCOMMENT VARCHAR (2000)  NOT NULL,
    DPYBATSERNO VARCHAR (30)  NOT NULL,
    DPYDATASTATUS VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWDPY ADD
    CONSTRAINT PK_FDWDPY PRIMARY KEY
    (
        DPYID
    );

/******************************************
FDWMPL   日常资金月缴款记录表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWMPL]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWMPL];
CREATE TABLE [dbo].[FDWMPL] (
    MPLACTNO VARCHAR (32)  NOT NULL,
    MPLMOUTH VARCHAR (6)  NOT NULL,
    MPLDPYID VARCHAR (32)  NOT NULL,
    MPLPAYABLEAMOUNT DECIMAL (15, 2)  NOT NULL,
    MPLACTUALAMOUNT DECIMAL (15, 2)  NOT NULL
);

ALTER TABLE FDWMPL ADD
    CONSTRAINT PK_FDWMPL PRIMARY KEY
    (
        MPLACTNO,
        MPLMOUTH,
        MPLDPYID
    );

/******************************************
FDWPAV   日常资金缴交合计表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPAV]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPAV];
CREATE TABLE [dbo].[FDWPAV] (
    PAVID VARCHAR (32)  NOT NULL,
    PAVNO VARCHAR (32)  NOT NULL,
    PAVMBDTYPE VARCHAR (20)  NOT NULL,
    PAVMBDID VARCHAR (32)  NOT NULL,
    PAVMBDNAME VARCHAR (100)  NOT NULL,
    PAVMODE VARCHAR (10)  NOT NULL,
    PAVSTATUS VARCHAR (1)  NOT NULL,
    PAVPAYABLEAMOUNT DECIMAL (15, 2)  NOT NULL,
    PAVACTUALAMOUNT DECIMAL (15, 2)  NOT NULL,
    PAVREMARK VARCHAR (200)  NOT NULL,
    PAVYHSPROMISEDATE VARCHAR (8)  NOT NULL,
    PAVYHSDEMANDDATE VARCHAR (8)  NOT NULL,
    PAVYHSPAUSEDATE VARCHAR (8)  NOT NULL,
    PAVYHSUSER VARCHAR (50)  NOT NULL,
    PAVYHSCOMPANY VARCHAR (100)  NOT NULL,
    PAVYHSDATE VARCHAR (8)  NOT NULL,
    PAVYHSTIME VARCHAR (6)  NOT NULL,
    PAVYHSCOMMENT VARCHAR (2000)  NOT NULL,
    PAVACCDATE VARCHAR (8)  NOT NULL,
    PAVDATASTATUS VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWPAV ADD
    CONSTRAINT PK_FDWPAV PRIMARY KEY
    (
        PAVID
    );

/******************************************
FDWDLW   日常维修对象集合表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWDLW]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWDLW];
CREATE TABLE [dbo].[FDWDLW] (
    DLWID VARCHAR (32)  NOT NULL,
    DLWDLYID VARCHAR (32)  NOT NULL,
    DLWPCTID VARCHAR (32)  NOT NULL,
    DLWITMNAME VARCHAR (200)  NOT NULL,
    DLWAPPOBJDESC VARCHAR (400)  NOT NULL,
    DLWAPPAMT DECIMAL (15, 2)  NOT NULL,
    DLWAUTHAMT DECIMAL (15, 2)  NOT NULL,
    DLWSYSAMT DECIMAL (15, 2)  NOT NULL,
    DLWAUDPRICE DECIMAL (15, 2)  NOT NULL,
    DLWDTLNUM INT  NOT NULL,
    DLWAREA DECIMAL (9, 2)  NOT NULL,
    DLWSTATUS VARCHAR (1)  NOT NULL,
    DLWREMARK VARCHAR (200)  NOT NULL,
    DLWVOTEDESC VARCHAR (1000)  NOT NULL,
    DLWVOTENUM INT  NOT NULL,
    DLWAGREEHOUSUM INT  NOT NULL,
    DLWAGREEAREASUM DECIMAL (9, 2)  NOT NULL,
    DLWYHSUSER VARCHAR (50)  NOT NULL,
    DLWYHSCOMPANY VARCHAR (100)  NOT NULL,
    DLWYHSDATE VARCHAR (8)  NOT NULL,
    DLWYHSTIME VARCHAR (6)  NOT NULL,
    DLWYHSCOMMENT VARCHAR (2000)  NOT NULL
);

ALTER TABLE FDWDLW ADD
    CONSTRAINT PK_FDWDLW PRIMARY KEY
    (
        DLWID
    );

/******************************************
FDWDLY   日常资金使用表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWDLY]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWDLY];
CREATE TABLE [dbo].[FDWDLY] (
    DLYID VARCHAR (32)  NOT NULL,
    DLYNO VARCHAR (32)  NOT NULL,
    DLYDTMID VARCHAR (32)  NOT NULL,
    DLYPYVID VARCHAR (32)  NOT NULL,
    DLYSRQID VARCHAR (32)  NOT NULL,
    DLYMBDTYPE VARCHAR (20)  NOT NULL,
    DLYMBDID VARCHAR (32)  NOT NULL,
    DLYMBDNAME VARCHAR (100)  NOT NULL,
    DLYITMNAME VARCHAR (200)  NOT NULL,
    DLYDAMAGEDESC TEXT  NOT NULL,
    DLYCSOID VARCHAR (32)  NOT NULL,
    DLYCONSTRUCTION VARCHAR (100)  NOT NULL,
    DLYPCTID VARCHAR (32)  NOT NULL,
    DLYISAUD VARCHAR (1)  NOT NULL,
    DLYISAPPAUD VARCHAR (1)  NOT NULL,
    DLYAPPAUDTYPE VARCHAR (64)  NOT NULL,
    DLYAPPAUDDESC VARCHAR (300)  NOT NULL,
    DLYMODE VARCHAR (10)  NOT NULL,
    DLYDATE VARCHAR (8)  NOT NULL,
    DLYREPAIRDATE VARCHAR (8)  NOT NULL,
    DLYTYPE VARCHAR (1)  NOT NULL,
    DLYREPAIRSCHEME TEXT  NOT NULL,
    DLYSTATUS VARCHAR (1)  NOT NULL,
    DLYOUTMODE VARCHAR (1)  NOT NULL,
    DLYAPPMODE VARCHAR (20)  NOT NULL,
    DLYBUDGETAMT DECIMAL (15, 2)  NOT NULL,
    DLYAPPAMT DECIMAL (15, 2)  NOT NULL,
    DLYREATYPE VARCHAR (64)  NOT NULL,
    DLYREASON VARCHAR (300)  NOT NULL,
    DLYAUDID VARCHAR (32)  NOT NULL,
    DLYAUDPRICE DECIMAL (15, 2)  NOT NULL,
    DLYAUTHAMT DECIMAL (15, 2)  NOT NULL,
    DLYSYSAMT DECIMAL (15, 2)  NOT NULL,
    DLYBYAUTHAMT DECIMAL (15, 2)  NOT NULL,
    DLYREMARK VARCHAR (200)  NOT NULL,
    DLYYHSPROMISEDATE VARCHAR (8)  NOT NULL,
    DLYYHSDEMANDDATE VARCHAR (8)  NOT NULL,
    DLYYHSPAUSEDATE VARCHAR (8)  NOT NULL,
    DLYYHSUSER VARCHAR (50)  NOT NULL,
    DLYYHSCOMPANY VARCHAR (100)  NOT NULL,
    DLYYHSDATE VARCHAR (8)  NOT NULL,
    DLYYHSTIME VARCHAR (6)  NOT NULL,
    DLYYHSCOMMENT VARCHAR (2000)  NOT NULL,
    DLYDATASTATUS VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWDLY ADD
    CONSTRAINT PK_FDWDLY PRIMARY KEY
    (
        DLYID
    );

/******************************************
FDWDTM   日常维修使用项目表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWDTM]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWDTM];
CREATE TABLE [dbo].[FDWDTM] (
    DTMID VARCHAR (32)  NOT NULL,
    DTMNO VARCHAR (32)  NOT NULL,
    DTMPYVID VARCHAR (32)  NOT NULL,
    DTMNAME VARCHAR (100)  NOT NULL,
    DTMSRQID VARCHAR (32)  NOT NULL,
    DTMMBDTYPE VARCHAR (20)  NOT NULL,
    DTMMBDID VARCHAR (32)  NOT NULL,
    DTMMBDNAME VARCHAR (100)  NOT NULL,
    DTMMODE VARCHAR (10)  NOT NULL,
    DTMSTATUS VARCHAR (1)  NOT NULL,
    DTMAPPAMT DECIMAL (15, 2)  NOT NULL,
    DTMACTUALAMOUNT DECIMAL (15, 2)  NOT NULL,
    DTMSYSAMT DECIMAL (15, 2)  NOT NULL,
    DTMBYAUTHAMT DECIMAL (15, 2)  NOT NULL,
    DTMREMARK VARCHAR (200)  NOT NULL,
    DTMAPPPSN VARCHAR (20)  NOT NULL,
    DTMAPPLINKTEL VARCHAR (50)  NOT NULL,
    DTMYHSUSER VARCHAR (50)  NOT NULL,
    DTMYHSCOMPANY VARCHAR (100)  NOT NULL,
    DTMYHSDATE VARCHAR (8)  NOT NULL,
    DTMYHSTIME VARCHAR (6)  NOT NULL,
    DTMYHSCOMMENT VARCHAR (2000)  NOT NULL
);

ALTER TABLE FDWDTM ADD
    CONSTRAINT PK_FDWDTM PRIMARY KEY
    (
        DTMID
    );

/******************************************
FDWPYV   日常资金核销表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPYV]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPYV];
CREATE TABLE [dbo].[FDWPYV] (
    PYVID VARCHAR (32)  NOT NULL,
    PYVNO VARCHAR (32)  NOT NULL,
    PYVMBDTYPE VARCHAR (20)  NOT NULL,
    PYVMBDID VARCHAR (32)  NOT NULL,
    PYVMBDNAME VARCHAR (100)  NOT NULL,
    PYVMODE VARCHAR (10)  NOT NULL,
    PYVDATE VARCHAR (8)  NOT NULL,
    PYVSTATUS VARCHAR (1)  NOT NULL,
    PYVAPPAMT DECIMAL (15, 2)  NOT NULL,
    PYVACTUALAMOUNT DECIMAL (15, 2)  NOT NULL,
    PYVSYSAMT DECIMAL (15, 2)  NOT NULL,
    PYVBYAUTHAMT DECIMAL (15, 2)  NOT NULL,
    PYVREMARK VARCHAR (200)  NOT NULL,
    PYVYHSPROMISEDATE VARCHAR (8)  NOT NULL,
    PYVYHSDEMANDDATE VARCHAR (8)  NOT NULL,
    PYVYHSPAUSEDATE VARCHAR (8)  NOT NULL,
    PYVAPPPSN VARCHAR (20)  NOT NULL,
    PYVAPPLINKTEL VARCHAR (50)  NOT NULL,
    PYVYHSUSER VARCHAR (50)  NOT NULL,
    PYVYHSCOMPANY VARCHAR (100)  NOT NULL,
    PYVYHSDATE VARCHAR (8)  NOT NULL,
    PYVYHSTIME VARCHAR (6)  NOT NULL,
    PYVYHSCOMMENT VARCHAR (2000)  NOT NULL,
    PYVDATASTATUS VARCHAR (1)  NOT NULL,
    PYVPUBLICSTATUS VARCHAR (1)  NOT NULL,
    PYVPUBLICBEGINDATE VARCHAR (8)  NOT NULL,
    PYVPUBLICENDDATE VARCHAR (8)  NOT NULL
);

ALTER TABLE FDWPYV ADD
    CONSTRAINT PK_FDWPYV PRIMARY KEY
    (
        PYVID
    );

/******************************************
FDWREF   备用金申请表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWREF]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWREF];
CREATE TABLE [dbo].[FDWREF] (
    REFID VARCHAR (32)  NOT NULL,
    REFNO VARCHAR (32)  NOT NULL,
    REFRFVID VARCHAR (32)  NOT NULL,
    REFSRQID VARCHAR (32)  NOT NULL,
    REFMBDTYPE VARCHAR (20)  NOT NULL,
    REFMBDID VARCHAR (32)  NOT NULL,
    REFMBDNAME VARCHAR (100)  NOT NULL,
    REFDATE VARCHAR (8)  NOT NULL,
    REFBASE DECIMAL (15, 2)  NOT NULL,
    REFRATE DECIMAL (15, 2)  NOT NULL,
    REFTOTALAMOUNT DECIMAL (15, 2)  NOT NULL,
    REFAUTHAMTTRN DECIMAL (15, 2)  NOT NULL,
    REFAPPAMOUNT DECIMAL (15, 2)  NOT NULL,
    REFAUTAMOUNT DECIMAL (15, 2)  NOT NULL,
    REFSTATUS VARCHAR (1)  NOT NULL,
    REFREMARK VARCHAR (200)  NOT NULL,
    REFYHSPROMISEDATE VARCHAR (8)  NOT NULL,
    REFYHSDEMANDDATE VARCHAR (8)  NOT NULL,
    REFYHSPAUSEDATE VARCHAR (8)  NOT NULL,
    REFYHSUSER VARCHAR (50)  NOT NULL,
    REFYHSCOMPANY VARCHAR (100)  NOT NULL,
    REFYHSDATE VARCHAR (8)  NOT NULL,
    REFYHSTIME VARCHAR (6)  NOT NULL,
    REFYHSCOMMENT VARCHAR (2000)  NOT NULL,
    REFDATASTATUS VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWREF ADD
    CONSTRAINT PK_FDWREF PRIMARY KEY
    (
        REFID
    );

/******************************************
FDWRFV   备用金核销表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWRFV]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWRFV];
CREATE TABLE [dbo].[FDWRFV] (
    RFVID VARCHAR (32)  NOT NULL,
    RFVNO VARCHAR (32)  NOT NULL,
    RFVMBDTYPE VARCHAR (20)  NOT NULL,
    RFVMBDID VARCHAR (32)  NOT NULL,
    RFVMBDNAME VARCHAR (100)  NOT NULL,
    RFVMODE VARCHAR (10)  NOT NULL,
    RFVDATE VARCHAR (8)  NOT NULL,
    RFVSTATUS VARCHAR (1)  NOT NULL,
    RFVAPPAMT DECIMAL (15, 2)  NOT NULL,
    RFVACTUALAMOUNT DECIMAL (15, 2)  NOT NULL,
    RFVREMARK VARCHAR (200)  NOT NULL,
    RFVYHSPROMISEDATE VARCHAR (8)  NOT NULL,
    RFVYHSDEMANDDATE VARCHAR (8)  NOT NULL,
    RFVYHSPAUSEDATE VARCHAR (8)  NOT NULL,
    RFVYHSUSER VARCHAR (50)  NOT NULL,
    RFVYHSCOMPANY VARCHAR (100)  NOT NULL,
    RFVYHSDATE VARCHAR (8)  NOT NULL,
    RFVYHSTIME VARCHAR (6)  NOT NULL,
    RFVYHSCOMMENT VARCHAR (2000)  NOT NULL,
    RFVDATASTATUS VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWRFV ADD
    CONSTRAINT PK_FDWRFV PRIMARY KEY
    (
        RFVID
    );

/******************************************
FDWFCS   附件种类表(附件库)
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWFCS]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWFCS];
CREATE TABLE [dbo].[FDWFCS] (
    FCSID VARCHAR (32)  NOT NULL,
    FCSNAME VARCHAR (128)  NOT NULL,
    FCSCODE VARCHAR (128)  NOT NULL,
    FCSTYPE VARCHAR (1)  NOT NULL,
    FCSISPUBLICITY VARCHAR (1)  NOT NULL,
    FCSISPUSH VARCHAR (1)  NOT NULL,
    FCSDESC VARCHAR (256)  NOT NULL
);

ALTER TABLE FDWFCS ADD
    CONSTRAINT PK_FDWFCS PRIMARY KEY
    (
        FCSID
    );

/******************************************
FDWFTL   附件配置表(附件库)
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWFTL]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWFTL];
CREATE TABLE [dbo].[FDWFTL] (
    FTLID VARCHAR (32)  NOT NULL,
    FTLPRUID VARCHAR (50)  NOT NULL,
    FTLFIELD VARCHAR (50)  NOT NULL,
    FTLNOWSTATUS VARCHAR (1)  NOT NULL,
    FTLNAME VARCHAR (50)  NOT NULL
);

ALTER TABLE FDWFTL ADD
    CONSTRAINT PK_FDWFTL PRIMARY KEY
    (
        FTLID
    );

/******************************************
FDWFTC   附件配置条件表(附件库)
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWFTC]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWFTC];
CREATE TABLE [dbo].[FDWFTC] (
    FTCFTLID VARCHAR (32)  NOT NULL,
    FTCID VARCHAR (32)  NOT NULL,
    FTCNAME VARCHAR (64)  NOT NULL,
    FTCNUM INT  NOT NULL
);

ALTER TABLE FDWFTC ADD
    CONSTRAINT PK_FDWFTC PRIMARY KEY
    (
        FTCFTLID,
        FTCID
    );

/******************************************
FDWFCL   附件策略表(附件库)
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWFCL]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWFCL];
CREATE TABLE [dbo].[FDWFCL] (
    FCLID VARCHAR (32)  NOT NULL,
    FCLPRUID VARCHAR (50)  NOT NULL,
    FCLFIELD VARCHAR (50)  NOT NULL,
    FCLNOWSTATUS VARCHAR (50)  NOT NULL,
    FCLNAME VARCHAR (50)  NOT NULL,
    FCLDESC VARCHAR (1000)  NOT NULL
);

ALTER TABLE FDWFCL ADD
    CONSTRAINT PK_FDWFCL PRIMARY KEY
    (
        FCLID
    );

/******************************************
FDWFCC   附件策略条件表(附件库)
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWFCC]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWFCC];
CREATE TABLE [dbo].[FDWFCC] (
    FCCFCLID VARCHAR (32)  NOT NULL,
    FCCID VARCHAR (32)  NOT NULL,
    FCCNAME VARCHAR (64)  NOT NULL,
    FCCVALUES VARCHAR (64)  NOT NULL
);

ALTER TABLE FDWFCC ADD
    CONSTRAINT PK_FDWFCC PRIMARY KEY
    (
        FCCFCLID,
        FCCID
    );

/******************************************
FDWFCM   附件策略明细表(附件库)
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWFCM]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWFCM];
CREATE TABLE [dbo].[FDWFCM] (
    FCMFCLID VARCHAR (32)  NOT NULL,
    FCMFCSID VARCHAR (32)  NOT NULL,
    FCMISMUST VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWFCM ADD
    CONSTRAINT PK_FDWFCM PRIMARY KEY
    (
        FCMFCLID,
        FCMFCSID
    );

/******************************************
FDWFRC   附件关联表(附件库)
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWFRC]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWFRC];
CREATE TABLE [dbo].[FDWFRC] (
    FRCMBDID VARCHAR (32)  NOT NULL,
    FRCFLIID VARCHAR (32)  NOT NULL,
    FRCFCSID VARCHAR (32)  NOT NULL,
    FRCNUM INT  NOT NULL
);

ALTER TABLE FDWFRC ADD
    CONSTRAINT PK_FDWFRC PRIMARY KEY
    (
        FRCMBDID,
        FRCFLIID
    );

/******************************************
FDWFLI   附件描述表(附件库)
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWFLI]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWFLI];
CREATE TABLE [dbo].[FDWFLI] (
    FLIID VARCHAR (32)  NOT NULL,
    FLISOURCE VARCHAR (1)  NOT NULL,
    FLINAME VARCHAR (128)  NOT NULL,
    FLIENT VARCHAR (32)  NOT NULL,
    FLISIZE INT  NOT NULL,
    FLIFLEID VARCHAR (32)  NOT NULL,
    FLIPUSH VARCHAR (1)  NOT NULL,
    FLIDESC VARCHAR (256)  NOT NULL,
    FLIMD VARCHAR (1024)  NOT NULL,
    FLIDATE VARCHAR (8)  NOT NULL,
    FLITIME VARCHAR (6)  NOT NULL
);

ALTER TABLE FDWFLI ADD
    CONSTRAINT PK_FDWFLI PRIMARY KEY
    (
        FLIID
    );

/******************************************
FDWFLE   附件内容表(附件库)
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWFLE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWFLE];
CREATE TABLE [dbo].[FDWFLE] (
    FLEID VARCHAR (32)  NOT NULL,
    FLECONTEXT IMAGE  NOT NULL
);

ALTER TABLE FDWFLE ADD
    CONSTRAINT PK_FDWFLE PRIMARY KEY
    (
        FLEID
    );

/******************************************
FDWUBJ   维修对象表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWUBJ]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWUBJ];
CREATE TABLE [dbo].[FDWUBJ] (
    UBJID VARCHAR (32)  NOT NULL,
    UBJNAME VARCHAR (64)  NOT NULL,
    UBJUPID VARCHAR (32)  NOT NULL,
    UBJISPOINTCB VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWUBJ ADD
    CONSTRAINT PK_FDWUBJ PRIMARY KEY
    (
        UBJID
    );

/******************************************
FDWPCT   维修类型表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPCT]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPCT];
CREATE TABLE [dbo].[FDWPCT] (
    PCTID VARCHAR (32)  NOT NULL,
    PCTUBJID VARCHAR (32)  NOT NULL,
    PCTNAME VARCHAR (128)  NOT NULL,
    PCTEMERGSIGN VARCHAR (1)  NOT NULL,
    PCTISAUD VARCHAR (1)  NOT NULL,
    PCTEMERGCONDITION VARCHAR (1000)  NOT NULL,
    PCTSTATUS VARCHAR (1)  NOT NULL,
    PCTISPOINTCB VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWPCT ADD
    CONSTRAINT PK_FDWPCT PRIMARY KEY
    (
        PCTID
    );

/******************************************
FDWRTP   留存比例表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWRTP]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWRTP];
CREATE TABLE [dbo].[FDWRTP] (
    RTPID VARCHAR (32)  NOT NULL,
    RTPYEARS INT  NOT NULL,
    RTPPERCENTAGE DECIMAL (5, 2)  NOT NULL
);

ALTER TABLE FDWRTP ADD
    CONSTRAINT PK_FDWRTP PRIMARY KEY
    (
        RTPID
    );

/******************************************
FDWADP   审价流程参与配置表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWADP]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWADP];
CREATE TABLE [dbo].[FDWADP] (
    ADPID VARCHAR (32)  NOT NULL,
    ADPATKKIND VARCHAR (32)  NOT NULL,
    ADPMONEY DECIMAL (15, 2)  NOT NULL
);

ALTER TABLE FDWADP ADD
    CONSTRAINT PK_FDWADP PRIMARY KEY
    (
        ADPID
    );

/******************************************
FDWGPY   公共收益缴款表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWGPY]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWGPY];
CREATE TABLE [dbo].[FDWGPY] (
    GPYID VARCHAR (32)  NOT NULL,
    GPYNO VARCHAR (32)  NOT NULL,
    GPYGAVID VARCHAR (32)  NOT NULL,
    GPYSRQID VARCHAR (32)  NOT NULL,
    GPYMBDTYPE VARCHAR (20)  NOT NULL,
    GPYMBDID VARCHAR (32)  NOT NULL,
    GPYMBDNAME VARCHAR (100)  NOT NULL,
    GPYMODE VARCHAR (10)  NOT NULL,
    GPYFROM VARCHAR (64)  NOT NULL,
    GPYSTATUS VARCHAR (1)  NOT NULL,
    GPYACTUALAMOUNT DECIMAL (15, 2)  NOT NULL,
    GPYSTRMOUTH VARCHAR (6)  NOT NULL,
    GPYENDMOUTH VARCHAR (6)  NOT NULL,
    GPYACCDATE VARCHAR (8)  NOT NULL,
    GPYREMARK VARCHAR (200)  NOT NULL,
    GPYYHSPROMISEDATE VARCHAR (8)  NOT NULL,
    GPYYHSDEMANDDATE VARCHAR (8)  NOT NULL,
    GPYYHSPAUSEDATE VARCHAR (8)  NOT NULL,
    GPYYHSUSER VARCHAR (50)  NOT NULL,
    GPYYHSCOMPANY VARCHAR (100)  NOT NULL,
    GPYYHSDATE VARCHAR (8)  NOT NULL,
    GPYYHSTIME VARCHAR (6)  NOT NULL,
    GPYYHSCOMMENT VARCHAR (2000)  NOT NULL,
    GPYDATASTATUS VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWGPY ADD
    CONSTRAINT PK_FDWGPY PRIMARY KEY
    (
        GPYID
    );

/******************************************
FDWGAV   公共收益缴交合计表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWGAV]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWGAV];
CREATE TABLE [dbo].[FDWGAV] (
    GAVID VARCHAR (32)  NOT NULL,
    GAVNO VARCHAR (32)  NOT NULL,
    GAVMBDTYPE VARCHAR (20)  NOT NULL,
    GAVMBDID VARCHAR (32)  NOT NULL,
    GAVMBDNAME VARCHAR (100)  NOT NULL,
    GAVMODE VARCHAR (10)  NOT NULL,
    GAVSTATUS VARCHAR (1)  NOT NULL,
    GAVACTUALAMOUNT DECIMAL (15, 2)  NOT NULL,
    GAVACCDATE VARCHAR (8)  NOT NULL,
    GAVREMARK VARCHAR (200)  NOT NULL,
    GAVYHSPROMISEDATE VARCHAR (8)  NOT NULL,
    GAVYHSDEMANDDATE VARCHAR (8)  NOT NULL,
    GAVYHSPAUSEDATE VARCHAR (8)  NOT NULL,
    GAVYHSUSER VARCHAR (50)  NOT NULL,
    GAVYHSCOMPANY VARCHAR (100)  NOT NULL,
    GAVYHSDATE VARCHAR (8)  NOT NULL,
    GAVYHSTIME VARCHAR (6)  NOT NULL,
    GAVYHSCOMMENT VARCHAR (2000)  NOT NULL,
    GAVDATASTATUS VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWGAV ADD
    CONSTRAINT PK_FDWGAV PRIMARY KEY
    (
        GAVID
    );

/******************************************
FDWGLY   公共收益使用表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWGLY]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWGLY];
CREATE TABLE [dbo].[FDWGLY] (
    GLYID VARCHAR (32)  NOT NULL,
    GLYNO VARCHAR (32)  NOT NULL,
    GLYSRQID VARCHAR (32)  NOT NULL,
    GLYMBDTYPE VARCHAR (20)  NOT NULL,
    GLYMBDID VARCHAR (32)  NOT NULL,
    GLYMBDNAME VARCHAR (100)  NOT NULL,
    GLYITMNAME VARCHAR (200)  NOT NULL,
    GLYPCTID VARCHAR (32)  NOT NULL,
    GLYDAMAGEDESC VARCHAR (300)  NOT NULL,
    GLYMODE VARCHAR (10)  NOT NULL,
    GLYREPAIRDATE VARCHAR (8)  NOT NULL,
    GLYDATE VARCHAR (8)  NOT NULL,
    GLYSTATUS VARCHAR (1)  NOT NULL,
    GLYOUTMODE VARCHAR (1)  NOT NULL,
    GLYBUDGETAMT DECIMAL (15, 2)  NOT NULL,
    GLYAPPAMT DECIMAL (15, 2)  NOT NULL,
    GLYREATYPE VARCHAR (64)  NOT NULL,
    GLYREASON VARCHAR (150)  NOT NULL,
    GLYAUD VARCHAR (1)  NOT NULL,
    GLYISAUD VARCHAR (1)  NOT NULL,
    GLYISAPPAUD VARCHAR (1)  NOT NULL,
    GLYAPPAUDTYPE VARCHAR (64)  NOT NULL,
    GLYAPPAUDDESC VARCHAR (300)  NOT NULL,
    GLYAUDID VARCHAR (32)  NOT NULL,
    GLYAUDPRICE DECIMAL (15, 2)  NOT NULL,
    GLYAUTHAMT DECIMAL (15, 2)  NOT NULL,
    GLYSYSAMT DECIMAL (15, 2)  NOT NULL,
    GLYADDSUM DECIMAL (15, 2)  NOT NULL,
    GLYAUTHAMTTRN DECIMAL (15, 2)  NOT NULL,
    GLYSYSAMTTRN DECIMAL (15, 2)  NOT NULL,
    GLYAPPLINK VARCHAR (100)  NOT NULL,
    GLYAPPLINKTEL VARCHAR (50)  NOT NULL,
    GLYAPPLINKJOB VARCHAR (200)  NOT NULL,
    GLYAPPLINKPHONE VARCHAR (50)  NOT NULL,
    GLYCOMMENT VARCHAR (200)  NOT NULL,
    GLYYHSPROMISEDATE VARCHAR (8)  NOT NULL,
    GLYYHSDEMANDDATE VARCHAR (8)  NOT NULL,
    GLYYHSPAUSEDATE VARCHAR (8)  NOT NULL,
    GLYYHSUSER VARCHAR (50)  NOT NULL,
    GLYYHSCOMPANY VARCHAR (100)  NOT NULL,
    GLYYHSDATE VARCHAR (8)  NOT NULL,
    GLYYHSTIME VARCHAR (6)  NOT NULL,
    GLYYHSCOMMENT VARCHAR (2000)  NOT NULL,
    GLYDATASTATUS VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWGLY ADD
    CONSTRAINT PK_FDWGLY PRIMARY KEY
    (
        GLYID
    );

/******************************************
FDWYPA   日常维修年度计划表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWYPA]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWYPA];
CREATE TABLE [dbo].[FDWYPA] (
    YPAID VARCHAR (32)  NOT NULL,
    YPAMBDID VARCHAR (32)  NOT NULL,
    YPAMBDTYPE VARCHAR (32)  NOT NULL,
    YPASRQID VARCHAR (32)  NOT NULL,
    YPAYEAR VARCHAR (32)  NOT NULL,
    YPADESC VARCHAR (300)  NOT NULL,
    YPAPAYSUM DECIMAL (9, 2)  NOT NULL,
    YPAPREDICTPAYSUM DECIMAL (9, 2)  NOT NULL,
    YPASUM DECIMAL (9, 2)  NOT NULL,
    YPASTATUS VARCHAR (1)  NOT NULL,
    YPAYHSUSER VARCHAR (50)  NOT NULL,
    YPAYHSCOMPANY VARCHAR (100)  NOT NULL,
    YPAYHSDATE VARCHAR (8)  NOT NULL,
    YPAYHSTIME VARCHAR (6)  NOT NULL,
    YPAYHSCOMMENT VARCHAR (2000)  NOT NULL
);

ALTER TABLE FDWYPA ADD
    CONSTRAINT PK_FDWYPA PRIMARY KEY
    (
        YPAID
    );

/******************************************
FDWYPM   日常维修年度计划明细
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWYPM]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWYPM];
CREATE TABLE [dbo].[FDWYPM] (
    YPMID VARCHAR (32)  NOT NULL,
    YPMYPAID VARCHAR (32)  NOT NULL,
    YPMPCTID VARCHAR (32)  NOT NULL,
    YPMBUDGET DECIMAL (9, 2)  NOT NULL,
    YPMDESC VARCHAR (300)  NOT NULL
);

ALTER TABLE FDWYPM ADD
    CONSTRAINT PK_FDWYPM PRIMARY KEY
    (
        YPMID
    );

/******************************************
FDWDRN   日常维修留存金额申请表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWDRN]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWDRN];
CREATE TABLE [dbo].[FDWDRN] (
    DRNID VARCHAR (32)  NOT NULL,
    DRNMBDID VARCHAR (32)  NOT NULL,
    DRNMBDTYPE VARCHAR (32)  NOT NULL,
    DRNSRQID VARCHAR (32)  NOT NULL,
    DRNDESC VARCHAR (300)  NOT NULL,
    DRNSUM DECIMAL (9, 2)  NOT NULL,
    DRNAPPMODE VARCHAR (20)  NOT NULL,
    DRNSTATUS VARCHAR (1)  NOT NULL,
    DRNYHSUSER VARCHAR (50)  NOT NULL,
    DRNYHSCOMPANY VARCHAR (100)  NOT NULL,
    DRNYHSDATE VARCHAR (8)  NOT NULL,
    DRNYHSTIME VARCHAR (6)  NOT NULL,
    DRNYHSCOMMENT VARCHAR (2000)  NOT NULL
);

ALTER TABLE FDWDRN ADD
    CONSTRAINT PK_FDWDRN PRIMARY KEY
    (
        DRNID
    );

/******************************************
FDWDRM   日常维修留存金额申请明细
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWDRM]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWDRM];
CREATE TABLE [dbo].[FDWDRM] (
    DRMID VARCHAR (32)  NOT NULL,
    DRMDRNID VARCHAR (32)  NOT NULL,
    DRMACTNO VARCHAR (32)  NOT NULL,
    DRMBUDGET DECIMAL (9, 2)  NOT NULL
);

ALTER TABLE FDWDRM ADD
    CONSTRAINT PK_FDWDRM PRIMARY KEY
    (
        DRMID
    );

/******************************************
FDWFUS   资金转换表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWFUS]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWFUS];
CREATE TABLE [dbo].[FDWFUS] (
    FUSID VARCHAR (32)  NOT NULL,
    FUSNO VARCHAR (32)  NOT NULL,
    FUSNAME VARCHAR (100)  NOT NULL,
    FUSMBDTYPE VARCHAR (20)  NOT NULL,
    FUSMBDID VARCHAR (32)  NOT NULL,
    FUSSRQID VARCHAR (32)  NOT NULL,
    FUSREASON VARCHAR (200)  NOT NULL,
    FUSTYPE VARCHAR (50)  NOT NULL,
    FUSOUTKIND VARCHAR (32)  NOT NULL,
    FUSINKIND VARCHAR (32)  NOT NULL,
    FUSAPPMODE VARCHAR (20)  NOT NULL,
    FUSMONEY DECIMAL (9, 2)  NOT NULL,
    FUSDATE VARCHAR (8)  NOT NULL,
    FUSDATASTATUS VARCHAR (1)  NOT NULL,
    FUSDESC VARCHAR (200)  NOT NULL,
    FUSSTATUS VARCHAR (1)  NOT NULL,
    FUSYHSUSER VARCHAR (100)  NOT NULL,
    FUSYHSCOMPANY VARCHAR (100)  NOT NULL,
    FUSYHSDATE VARCHAR (8)  NOT NULL,
    FUSYHSTIME VARCHAR (6)  NOT NULL,
    FUSYHSCOMMENT VARCHAR (200)  NOT NULL
);

ALTER TABLE FDWFUS ADD
    CONSTRAINT PK_FDWFUS PRIMARY KEY
    (
        FUSID
    );

/******************************************
FDWFUO   资金转换转出明细表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWFUO]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWFUO];
CREATE TABLE [dbo].[FDWFUO] (
    FUOID VARCHAR (32)  NOT NULL,
    FUOFUSID VARCHAR (32)  NOT NULL,
    FUOACTNO VARCHAR (32)  NOT NULL,
    FUOMONEY DECIMAL (9, 2)  NOT NULL
);

ALTER TABLE FDWFUO ADD
    CONSTRAINT PK_FDWFUO PRIMARY KEY
    (
        FUOID
    );

/******************************************
FDWDOC   公文表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWDOC]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWDOC];
CREATE TABLE [dbo].[FDWDOC] (
    DOCID VARCHAR (32)  NOT NULL,
    DOCNAME VARCHAR (150)  NOT NULL,
    DOCSTATUS VARCHAR (1)  NOT NULL,
    DOCDESC VARCHAR (500)  NOT NULL,
    DOCADDUSRID VARCHAR (32)  NOT NULL,
    DOCCHECKUSRID VARCHAR (32)  NOT NULL,
    DOCAUDITUSRID VARCHAR (32)  NOT NULL,
    DOCTYPE VARCHAR (20)  NOT NULL,
    DOCJURISDICTION VARCHAR (10)  NOT NULL,
    DOCSIGNMARK VARCHAR (1)  NOT NULL,
    DOCYHSUSER VARCHAR (100)  NOT NULL,
    DOCYHSCOMPANY VARCHAR (100)  NOT NULL,
    DOCYHSDATE VARCHAR (8)  NOT NULL,
    DOCYHSTIME VARCHAR (6)  NOT NULL,
    DOCYHSCOMMENT VARCHAR (200)  NOT NULL,
    DOCKEYWORD VARCHAR (100)  NOT NULL,
    DOCMAINTRAN VARCHAR (100)  NOT NULL,
    DOCCOPYTRAN VARCHAR (200)  NOT NULL,
    DOCNUMBER VARCHAR (32)  NOT NULL,
    DOCAPPENDIX VARCHAR (200)  NOT NULL
);

ALTER TABLE FDWDOC ADD
    CONSTRAINT PK_FDWDOC PRIMARY KEY
    (
        DOCID
    );

/******************************************
FDWDOH   公文历史表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWDOH]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWDOH];
CREATE TABLE [dbo].[FDWDOH] (
    DOHID VARCHAR (32)  NOT NULL,
    DOHDOCID VARCHAR (32)  NOT NULL,
    DOHUSER VARCHAR (100)  NOT NULL,
    DOHCOMPANY VARCHAR (100)  NOT NULL,
    DOHDATE VARCHAR (8)  NOT NULL,
    DOHTIME VARCHAR (6)  NOT NULL
);

ALTER TABLE FDWDOH ADD
    CONSTRAINT PK_FDWDOH PRIMARY KEY
    (
        DOHID
    );

/******************************************
FDWDOU   公文查看人员表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWDOU]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWDOU];
CREATE TABLE [dbo].[FDWDOU] (
    DOUDOCID VARCHAR (32)  NOT NULL,
    DOUUSRID VARCHAR (32)  NOT NULL,
    DOURECEIVE VARCHAR (1)  NOT NULL,
    DOURECEIVEDATE VARCHAR (8)  NOT NULL,
    DOURECEIVETIME VARCHAR (6)  NOT NULL
);

ALTER TABLE FDWDOU ADD
    CONSTRAINT PK_FDWDOU PRIMARY KEY
    (
        DOUDOCID,
        DOUUSRID
    );

/******************************************
FDWDOS   公文会签表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWDOS]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWDOS];
CREATE TABLE [dbo].[FDWDOS] (
    DOSDOCID VARCHAR (32)  NOT NULL,
    DOSUSRID VARCHAR (32)  NOT NULL,
    DOSSIGN VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWDOS ADD
    CONSTRAINT PK_FDWDOS PRIMARY KEY
    (
        DOSDOCID,
        DOSUSRID
    );

/******************************************
FDWVCP   凭证包数据表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWVCP]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWVCP];
CREATE TABLE [dbo].[FDWVCP] (
    VCPID VARCHAR (32)  NOT NULL,
    VCPATKKIND VARCHAR (32)  NOT NULL,
    VCPSTATUS VARCHAR (1)  NOT NULL,
    VCPSTARTNO INT  NOT NULL,
    VCPVCHPB INT  NOT NULL,
    VCPBOOKCNT INT  NOT NULL,
    VCPENDNO INT  NOT NULL,
    VCPUNITID VARCHAR (32)  NOT NULL,
    VCPREGUSR VARCHAR (32)  NOT NULL,
    VCPREGDATE VARCHAR (8)  NOT NULL,
    VCPDRAWUSR VARCHAR (32)  NOT NULL,
    VCPDRAWDATE VARCHAR (8)  NOT NULL,
    VCPSAVEUSR VARCHAR (32)  NOT NULL,
    VCPSAVEDATE VARCHAR (8)  NOT NULL,
    VCPCOMMENT VARCHAR (512)  NOT NULL,
    VCPVCHCNT INT  NOT NULL,
    VCPBVCHCNT INT  NOT NULL,
    VCPUVCHCNT INT  NOT NULL,
    VCPUVCHAMT DECIMAL (15, 2)  NOT NULL,
    VCPCVCHCNT INT  NOT NULL,
    VCPCVCHAMT DECIMAL (15, 2)  NOT NULL
);

ALTER TABLE FDWVCP ADD
    CONSTRAINT PK_FDWVCP PRIMARY KEY
    (
        VCPID
    );

/******************************************
FDWVCB   凭证本数据表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWVCB]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWVCB];
CREATE TABLE [dbo].[FDWVCB] (
    VCBID VARCHAR (32)  NOT NULL,
    VCBVCPID VARCHAR (32)  NOT NULL,
    VCBATKKIND VARCHAR (32)  NOT NULL,
    VCBUNITID VARCHAR (32)  NOT NULL,
    VCBSTATUS VARCHAR (1)  NOT NULL,
    VCBSTARTNO INT  NOT NULL,
    VCBVCHCNT INT  NOT NULL,
    VCBENDNO INT  NOT NULL,
    VCBBVCHCNT INT  NOT NULL,
    VCBUVCHCNT INT  NOT NULL,
    VCBUVCHAMT DECIMAL (15, 2)  NOT NULL,
    VCBCVCHCNT INT  NOT NULL,
    VCBCVCHAMT DECIMAL (15, 2)  NOT NULL,
    VCBDRAWUSR VARCHAR (32)  NOT NULL,
    VCBDRAWDATE VARCHAR (8)  NOT NULL,
    VCBSAVEUSR VARCHAR (32)  NOT NULL,
    VCBSAVEDATE VARCHAR (8)  NOT NULL,
    VCBUSEPSNID VARCHAR (16)  NOT NULL,
    VCBUSEPSNNAME VARCHAR (32)  NOT NULL,
    VCBPSNDRAWUSR VARCHAR (32)  NOT NULL,
    VCBPSNDRAWDATE VARCHAR (8)  NOT NULL
);

ALTER TABLE FDWVCB ADD
    CONSTRAINT PK_FDWVCB PRIMARY KEY
    (
        VCBID
    );

/******************************************
FDWVCH   凭证数据表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWVCH]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWVCH];
CREATE TABLE [dbo].[FDWVCH] (
    VCHID VARCHAR (32)  NOT NULL,
    VCHHISCNT INT  NOT NULL,
    VCHVCBID VARCHAR (32)  NOT NULL,
    VCHATKKIND VARCHAR (32)  NOT NULL,
    VCHUNITID VARCHAR (32)  NOT NULL,
    VCHNO INT  NOT NULL,
    VCHSTATUS VARCHAR (1)  NOT NULL,
    VCHAMT DECIMAL (15, 2)  NOT NULL,
    VCHUSRNAME VARCHAR (32)  NOT NULL,
    VCHDATE VARCHAR (8)  NOT NULL,
    VCHTIME VARCHAR (6)  NOT NULL,
    VCHMBDNAME VARCHAR (512)  NOT NULL,
    VCHMBDID VARCHAR (32)  NOT NULL,
    VCHCOMMENT VARCHAR (512)  NOT NULL,
    VCHHEADKIND VARCHAR (4)  NOT NULL,
    VCHUSEPSNID VARCHAR (16)  NOT NULL,
    VCHUSEPSNNAME VARCHAR (32)  NOT NULL,
    VCHUSETYPE VARCHAR (20)  NOT NULL
);

ALTER TABLE FDWVCH ADD
    CONSTRAINT PK_FDWVCH PRIMARY KEY
    (
        VCHID
    );

/******************************************
FDWVHH   凭证处理历史数据表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWVHH]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWVHH];
CREATE TABLE [dbo].[FDWVHH] (
    VHHID VARCHAR (32)  NOT NULL,
    VHHVCHID VARCHAR (32)  NOT NULL,
    VHHVCHNO INT  NOT NULL,
    VHHSTATUS VARCHAR (1)  NOT NULL,
    VHHAMT DECIMAL (15, 2)  NOT NULL,
    VHHUSRORGID VARCHAR (32)  NOT NULL,
    VHHUSRORGNAME VARCHAR (50)  NOT NULL,
    VHHUSRID VARCHAR (32)  NOT NULL,
    VHHDATE VARCHAR (8)  NOT NULL,
    VHHTIME VARCHAR (6)  NOT NULL,
    VHHMBDNAME VARCHAR (512)  NOT NULL,
    VHHMBDID VARCHAR (32)  NOT NULL,
    VHHCOMMENT VARCHAR (512)  NOT NULL,
    VHHHEADKIND VARCHAR (4)  NOT NULL,
    VHHUSETYPE VARCHAR (20)  NOT NULL
);

ALTER TABLE FDWVHH ADD
    CONSTRAINT PK_FDWVHH PRIMARY KEY
    (
        VHHID
    );

/******************************************
FDWFUI   资金转换转入明细表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWFUI]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWFUI];
CREATE TABLE [dbo].[FDWFUI] (
    FUIID VARCHAR (32)  NOT NULL,
    FUIFUSID VARCHAR (32)  NOT NULL,
    FUIACTNO VARCHAR (32)  NOT NULL,
    FUIMONEY DECIMAL (9, 2)  NOT NULL
);

ALTER TABLE FDWFUI ADD
    CONSTRAINT PK_FDWFUI PRIMARY KEY
    (
        FUIID
    );

/******************************************
FDWAPO   审批意见表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWAPO]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWAPO];
CREATE TABLE [dbo].[FDWAPO] (
    APOID VARCHAR (32)  NOT NULL,
    APOFIELD VARCHAR (32)  NOT NULL,
    APOPROCESS VARCHAR (200)  NOT NULL,
    APOPROCESSNAME VARCHAR (400)  NOT NULL,
    APODESC VARCHAR (1000)  NOT NULL,
    APOSTATUS VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWAPO ADD
    CONSTRAINT PK_FDWAPO PRIMARY KEY
    (
        APOID
    );

/******************************************
FDWPPD   保修金项目交存明细表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPPD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPPD];
CREATE TABLE [dbo].[FDWPPD] (
    PPDID VARCHAR (32)  NOT NULL,
    PPDMBDID VARCHAR (32)  NOT NULL,
    PPDBLDTYPE VARCHAR (100)  NOT NULL,
    PPDHOUPURPOSE VARCHAR (100)  NOT NULL,
    PPDPAYBASE DECIMAL (15, 2)  NOT NULL,
    PPDPAYRATE DECIMAL (9, 2)  NOT NULL,
    PPDPSYPER DECIMAL (15, 2)  NOT NULL,
    PPDAREA DECIMAL (15, 2)  NOT NULL,
    PPDPAYMONEY DECIMAL (15, 2)  NOT NULL
);

ALTER TABLE FDWPPD ADD
    CONSTRAINT PK_FDWPPD PRIMARY KEY
    (
        PPDID
    );

/******************************************
FDWPPY   保修金缴款表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPPY]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPPY];
CREATE TABLE [dbo].[FDWPPY] (
    PPYID VARCHAR (32)  NOT NULL,
    PPYNO VARCHAR (32)  NOT NULL,
    PPYNAME VARCHAR (100)  NOT NULL,
    PPYSRQID VARCHAR (32)  NOT NULL,
    PPYMBDTYPE VARCHAR (20)  NOT NULL,
    PPYMBDID VARCHAR (32)  NOT NULL,
    PPYMBDNAME VARCHAR (200)  NOT NULL,
    PPYBSIMBDTYPE VARCHAR (32)  NOT NULL,
    PPYBSIMBDID VARCHAR (32)  NOT NULL,
    PPYBSIMBDNAME VARCHAR (100)  NOT NULL,
    PPYPROPER VARCHAR (20)  NOT NULL,
    PPYPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    PPYACCRUAL DECIMAL (15, 2)  NOT NULL,
    PPYAREA DECIMAL (15, 4)  NOT NULL,
    PPYACCDATE VARCHAR (8)  NOT NULL,
    PPYSTATUS VARCHAR (1)  NOT NULL,
    PPYMODE VARCHAR (10)  NOT NULL,
    PPYCHECKNO VARCHAR (15)  NOT NULL,
    PPYTYPE VARCHAR (20)  NOT NULL,
    PPYBILDOCNUM VARCHAR (10)  NOT NULL,
    PPYBILDOCNO VARCHAR (20)  NOT NULL,
    PPYVCHID VARCHAR (32)  NOT NULL,
    PPYRELMAN VARCHAR (32)  NOT NULL,
    PPYRELTEL VARCHAR (20)  NOT NULL,
    PPYANLMODE VARCHAR (1)  NOT NULL,
    PPYBNKID VARCHAR (32)  NOT NULL,
    PPYREMARK VARCHAR (200)  NOT NULL,
    PPYMATRUE VARCHAR (8)  NOT NULL,
    PPYYHSUSER VARCHAR (50)  NOT NULL,
    PPYYHSCOMPANY VARCHAR (100)  NOT NULL,
    PPYYHSDATE VARCHAR (8)  NOT NULL,
    PPYYHSTIME VARCHAR (6)  NOT NULL,
    PPYYHSCOMMENT VARCHAR (2000)  NOT NULL
);

ALTER TABLE FDWPPY ADD
    CONSTRAINT PK_FDWPPY PRIMARY KEY
    (
        PPYID
    );

/******************************************
FDWPPL   保修金使用记录表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPPL]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPPL];
CREATE TABLE [dbo].[FDWPPL] (
    PPLID VARCHAR (32)  NOT NULL,
    PPLNO VARCHAR (32)  NOT NULL,
    PPLSRQID VARCHAR (32)  NOT NULL,
    PPLPACID VARCHAR (32)  NOT NULL,
    PPLITMNAME VARCHAR (100)  NOT NULL,
    PPLMBDTYPE VARCHAR (20)  NOT NULL,
    PPLMBDID VARCHAR (32)  NOT NULL,
    PPLMBDNAME VARCHAR (200)  NOT NULL,
    PPLBSIMBDTYPE VARCHAR (20)  NOT NULL,
    PPLBSIMBDID VARCHAR (32)  NOT NULL,
    PPLBSIMBDNAME VARCHAR (100)  NOT NULL,
    PPLAPPAMT DECIMAL (15, 2)  NOT NULL,
    PPLAUTHAMT DECIMAL (15, 2)  NOT NULL,
    PPLREASON VARCHAR (200)  NOT NULL,
    PPLAPPPSN VARCHAR (20)  NOT NULL,
    PPLAPPLINKTEL VARCHAR (50)  NOT NULL,
    PPLADDRESS VARCHAR (200)  NOT NULL,
    PPLFINDATE VARCHAR (8)  NOT NULL,
    PPLTRFTYPE VARCHAR (1)  NOT NULL,
    PPLOUTMODE VARCHAR (1)  NOT NULL,
    PPLSTATUS VARCHAR (1)  NOT NULL,
    PPLCOMMENT VARCHAR (200)  NOT NULL,
    PPLAUTHAMTPTN DECIMAL (15, 2)  NOT NULL,
    PPLPTNDATE VARCHAR (8)  NOT NULL,
    PPLYHSUSER VARCHAR (50)  NOT NULL,
    PPLYHSCOMPANY VARCHAR (100)  NOT NULL,
    PPLYHSDATE VARCHAR (8)  NOT NULL,
    PPLYHSTIME VARCHAR (6)  NOT NULL,
    PPLYHSCOMMENT VARCHAR (2000)  NOT NULL,
    PPLDATASTATUS VARCHAR (1)  NOT NULL,
    PPLORIMBDTYPE VARCHAR (32)  NOT NULL,
    PPLORIMBDID VARCHAR (32)  NOT NULL
);

ALTER TABLE FDWPPL ADD
    CONSTRAINT PK_FDWPPL PRIMARY KEY
    (
        PPLID
    );

/******************************************
FDWPPR   保修金退还记录表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPPR]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPPR];
CREATE TABLE [dbo].[FDWPPR] (
    PPRID VARCHAR (32)  NOT NULL,
    PPRNO VARCHAR (32)  NOT NULL,
    PPROUTID VARCHAR (32)  NOT NULL,
    PPRCAUID VARCHAR (32)  NOT NULL,
    PPRSRQID VARCHAR (32)  NOT NULL,
    PPRPUBLICITYDATE VARCHAR (8)  NOT NULL,
    PPRITMNAME VARCHAR (100)  NOT NULL,
    PPRDATE VARCHAR (8)  NOT NULL,
    PPRMBDTYPE VARCHAR (20)  NOT NULL,
    PPRMBDID VARCHAR (32)  NOT NULL,
    PPRMBDNAME VARCHAR (200)  NOT NULL,
    PPRBSIMBDTYPE VARCHAR (20)  NOT NULL,
    PPRBSIMBDID VARCHAR (32)  NOT NULL,
    PPRBSIMBDNAME VARCHAR (100)  NOT NULL,
    PPRRATE DECIMAL (15, 2)  NOT NULL,
    PPRPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    PPRACCRUAL DECIMAL (15, 2)  NOT NULL,
    PPRLOGOUT VARCHAR (1)  NOT NULL,
    PPRLOGACCRUAL DECIMAL (15, 2)  NOT NULL,
    PPRLOGDATA VARCHAR (8)  NOT NULL,
    PPRSTATUS VARCHAR (1)  NOT NULL,
    PPRDATASTATUS VARCHAR (1)  NOT NULL,
    PPRAPPPSN VARCHAR (20)  NOT NULL,
    PPRAPPLINKTEL VARCHAR (50)  NOT NULL,
    PPRYHSUSER VARCHAR (50)  NOT NULL,
    PPRYHSCOMPANY VARCHAR (100)  NOT NULL,
    PPRYHSDATE VARCHAR (8)  NOT NULL,
    PPRYHSTIME VARCHAR (6)  NOT NULL,
    PPRYHSCOMMENT VARCHAR (2000)  NOT NULL,
    PPRCWSBPRINT VARCHAR (1)  NOT NULL,
    PPRCAUSTATUS VARCHAR (32)  NOT NULL
);

ALTER TABLE FDWPPR ADD
    CONSTRAINT PK_FDWPPR PRIMARY KEY
    (
        PPRID
    );

/******************************************
FDWPBP   保修金退还配置表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPBP]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPBP];
CREATE TABLE [dbo].[FDWPBP] (
    PBPID VARCHAR (32)  NOT NULL,
    PBPNUM INT  NOT NULL,
    PBPYEAR INT  NOT NULL,
    PBPRATE DECIMAL (15, 2)  NOT NULL
);

ALTER TABLE FDWPBP ADD
    CONSTRAINT PK_FDWPBP PRIMARY KEY
    (
        PBPID
    );

/******************************************
FDWITP   利息分摊表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWITP]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWITP];
CREATE TABLE [dbo].[FDWITP] (
    ITPID VARCHAR (32)  NOT NULL,
    ITPACTKIND VARCHAR (32)  NOT NULL,
    ITPACCID VARCHAR (32)  NOT NULL,
    ITPDESC VARCHAR (500)  NOT NULL,
    ITPMONEY DECIMAL (15, 2)  NOT NULL,
    ITPUSR VARCHAR (32)  NOT NULL,
    ITPDATE VARCHAR (8)  NOT NULL,
    ITPCALDATE VARCHAR (8)  NOT NULL,
    ITPSTATUS VARCHAR (10)  NOT NULL
);

ALTER TABLE FDWITP ADD
    CONSTRAINT PK_FDWITP PRIMARY KEY
    (
        ITPID
    );

/******************************************
FDWITD   利息分摊明细
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWITD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWITD];
CREATE TABLE [dbo].[FDWITD] (
    ITDITPID VARCHAR (32)  NOT NULL,
    ITDACTNO VARCHAR (32)  NOT NULL,
    ITDACTMBDTYPE VARCHAR (20)  NOT NULL,
    ITDACTKIND VARCHAR (32)  NOT NULL,
    ITDAMOUNT DECIMAL (15, 2)  NOT NULL,
    ITDACTAMOUNT DECIMAL (15, 2)  NOT NULL
);

ALTER TABLE FDWITD ADD
    CONSTRAINT PK_FDWITD PRIMARY KEY
    (
        ITDITPID,
        ITDACTNO
    );

/******************************************
FDWBCG   博思接口配置表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWBCG]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWBCG];
CREATE TABLE [dbo].[FDWBCG] (
    BCGID VARCHAR (50)  NOT NULL,
    BCGVALUES VARCHAR (100)  NOT NULL
);

ALTER TABLE FDWBCG ADD
    CONSTRAINT PK_FDWBCG PRIMARY KEY
    (
        BCGID
    );

/******************************************
FDWRPT   报表定义信息表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWRPT]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWRPT];
CREATE TABLE [dbo].[FDWRPT] (
    RPTID VARCHAR (32)  NOT NULL,
    RPTNUM INT  NOT NULL,
    RPTNAME VARCHAR (64)  NOT NULL,
    RPTCRTYPE VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWRPT ADD
    CONSTRAINT PK_FDWRPT PRIMARY KEY
    (
        RPTID
    );

/******************************************
FDWIST   定期存款表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWIST]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWIST];
CREATE TABLE [dbo].[FDWIST] (
    ISTID VARCHAR (32)  NOT NULL,
    ISTDESC VARCHAR (100)  NOT NULL,
    ISTMONEY DECIMAL (15, 2)  NOT NULL,
    ISTRATE DECIMAL (15, 4)  NOT NULL,
    ISTACCDATE VARCHAR (8)  NOT NULL,
    ISTMOUTH INT  NOT NULL,
    ISTBECOMEDATE VARCHAR (8)  NOT NULL,
    ISTINTEREST DECIMAL (15, 2)  NOT NULL,
    ISTSTATUS VARCHAR (1)  NOT NULL,
    ISTTRUEDATE VARCHAR (8)  NOT NULL,
    ISTTRUEINTEREST DECIMAL (15, 2)  NOT NULL,
    ISTBNKNAME VARCHAR (100)  NOT NULL
);

ALTER TABLE FDWIST ADD
    CONSTRAINT PK_FDWIST PRIMARY KEY
    (
        ISTID
    );

/******************************************
FDWCPS   施工单位维修类型关系表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWCPS]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWCPS];
CREATE TABLE [dbo].[FDWCPS] (
    CPSCSOID VARCHAR (32)  NOT NULL,
    CPSPCTID VARCHAR (32)  NOT NULL
);

ALTER TABLE FDWCPS ADD
    CONSTRAINT PK_FDWCPS PRIMARY KEY
    (
        CPSCSOID,
        CPSPCTID
    );

/******************************************
FDWCSO   施工单位表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWCSO]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWCSO];
CREATE TABLE [dbo].[FDWCSO] (
    CSOID VARCHAR (32)  NOT NULL,
    CSONAME VARCHAR (100)  NOT NULL,
    CSOADDR VARCHAR (100)  NOT NULL,
    CSOLINKMAN VARCHAR (50)  NOT NULL,
    CSOLINKTEL VARCHAR (50)  NOT NULL,
    CSOLINKFAX VARCHAR (50)  NOT NULL,
    CSOZIPCODE VARCHAR (6)  NOT NULL,
    CSOFUNCRY VARCHAR (50)  NOT NULL,
    CSOFUNCRYTEL VARCHAR (50)  NOT NULL,
    CSOFUNCRYMBL VARCHAR (50)  NOT NULL,
    CSOLINKMANMBL VARCHAR (50)  NOT NULL,
    CSOEQUNIT VARCHAR (100)  NOT NULL,
    CSOEQLNO VARCHAR (40)  NOT NULL,
    CSOEQLCD VARCHAR (100)  NOT NULL,
    CSOCOMMENT VARCHAR (200)  NOT NULL,
    CSOSTATUS VARCHAR (1)  NOT NULL,
    CSOUSEDATE VARCHAR (8)  NOT NULL,
    CSORECORDUNIT VARCHAR (100)  NOT NULL,
    CSORECORDUSR VARCHAR (32)  NOT NULL,
    CSORECORDDATE VARCHAR (8)  NOT NULL,
    CSOAUDITUSR VARCHAR (32)  NOT NULL,
    CSOAUDITDATE VARCHAR (8)  NOT NULL
);

ALTER TABLE FDWCSO ADD
    CONSTRAINT PK_FDWCSO PRIMARY KEY
    (
        CSOID
    );

/******************************************
FDWCAP   施工单位申请表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWCAP]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWCAP];
CREATE TABLE [dbo].[FDWCAP] (
    CAPID VARCHAR (32)  NOT NULL,
    CAPTYPE VARCHAR (1)  NOT NULL,
    CAPCSOID VARCHAR (32)  NOT NULL,
    CAPNAME VARCHAR (100)  NOT NULL,
    CAPADDR VARCHAR (100)  NOT NULL,
    CAPLINKMAN VARCHAR (50)  NOT NULL,
    CAPLINKTEL VARCHAR (50)  NOT NULL,
    CAPLINKFAX VARCHAR (50)  NOT NULL,
    CAPZIPCODE VARCHAR (6)  NOT NULL,
    CAPFUNCRY VARCHAR (50)  NOT NULL,
    CAPFUNCRYTEL VARCHAR (50)  NOT NULL,
    CAPFUNCRYMBL VARCHAR (50)  NOT NULL,
    CAPLINKMANMBL VARCHAR (50)  NOT NULL,
    CAPEQUNIT VARCHAR (100)  NOT NULL,
    CAPEQLNO VARCHAR (40)  NOT NULL,
    CAPEQLCD VARCHAR (100)  NOT NULL,
    CAPUSEDATE VARCHAR (8)  NOT NULL,
    CAPCOMMENT VARCHAR (200)  NOT NULL,
    CAPSTATUS VARCHAR (1)  NOT NULL,
    CAPRECORDUNIT VARCHAR (100)  NOT NULL,
    CAPRECORDUSR VARCHAR (32)  NOT NULL,
    CAPRECORDDATE VARCHAR (8)  NOT NULL,
    CAPAUDITUSR VARCHAR (32)  NOT NULL,
    CAPAUDITDATE VARCHAR (8)  NOT NULL
);

ALTER TABLE FDWCAP ADD
    CONSTRAINT PK_FDWCAP PRIMARY KEY
    (
        CAPID
    );

/******************************************
FDWSAL   小区账户流水表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSAL]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSAL];
CREATE TABLE [dbo].[FDWSAL] (
    SALMBDID VARCHAR (32)  NOT NULL,
    SALSRQID VARCHAR (32)  NOT NULL,
    SALACTKIND VARCHAR (50)  NOT NULL,
    SALACCDATE VARCHAR (8)  NOT NULL,
    SALTYPE VARCHAR (50)  NOT NULL,
    SALPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    SALACCRUAL DECIMAL (15, 2)  NOT NULL
);

ALTER TABLE FDWSAL ADD
    CONSTRAINT PK_FDWSAL PRIMARY KEY
    (
        SALMBDID,
        SALSRQID,
        SALACTKIND
    );

/******************************************
FDWCAU   财政审批表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWCAU]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWCAU];
CREATE TABLE [dbo].[FDWCAU] (
    CAUID VARCHAR (32)  NOT NULL,
    CAUNO VARCHAR (32)  NOT NULL,
    CAUDATE VARCHAR (8)  NOT NULL,
    CAUATKKIND VARCHAR (32)  NOT NULL,
    CAUMONEY DECIMAL (15, 2)  NOT NULL,
    CAUACCDATE VARCHAR (8)  NOT NULL,
    CAUSTATUS VARCHAR (1)  NOT NULL,
    CAUDATESTATUS VARCHAR (1)  NOT NULL,
    CAUYHSUSER VARCHAR (50)  NOT NULL,
    CAUYHSCOMPANY VARCHAR (100)  NOT NULL,
    CAUYHSDATE VARCHAR (8)  NOT NULL,
    CAUYHSTIME VARCHAR (6)  NOT NULL,
    CAUYHSCOMMENT VARCHAR (2000)  NOT NULL
);

ALTER TABLE FDWCAU ADD
    CONSTRAINT PK_FDWCAU PRIMARY KEY
    (
        CAUID
    );

/******************************************
FDWNIF   网上查询相关政策表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWNIF]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWNIF];
CREATE TABLE [dbo].[FDWNIF] (
    NIFID VARCHAR (32)  NOT NULL,
    NIFNAME VARCHAR (256)  NOT NULL,
    NIFTYPE VARCHAR (2)  NOT NULL,
    NIFDESC TEXT  NOT NULL,
    NIFCHGDATE VARCHAR (8)  NOT NULL,
    NIFSTATUS VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWNIF ADD
    CONSTRAINT PK_FDWNIF PRIMARY KEY
    (
        NIFID
    );

/******************************************
FDWNME   网上查询业留言板表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWNME]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWNME];
CREATE TABLE [dbo].[FDWNME] (
    NMEID VARCHAR (32)  NOT NULL,
    NMENAME VARCHAR (32)  NOT NULL,
    NMESEX VARCHAR (2)  NOT NULL,
    NMEADDRE VARCHAR (256)  NOT NULL,
    NMEPHONE VARCHAR (128)  NOT NULL,
    NMEEMAIL VARCHAR (128)  NOT NULL,
    NMETITLE VARCHAR (256)  NOT NULL,
    NMEDESC TEXT  NOT NULL,
    NMEDATE VARCHAR (8)  NOT NULL,
    NMEREVNAME VARCHAR (32)  NOT NULL,
    NMEREVERT TEXT  NOT NULL,
    NMEREVDATE VARCHAR (8)  NOT NULL,
    NMESTATUS VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWNME ADD
    CONSTRAINT PK_FDWNME PRIMARY KEY
    (
        NMEID
    );

/******************************************
FDWNRG   网上查询业主查询注册表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWNRG]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWNRG];
CREATE TABLE [dbo].[FDWNRG] (
    NRGID VARCHAR (32)  NOT NULL,
    NRGNO VARCHAR (32)  NOT NULL,
    NRGPASSWD VARCHAR (32)  NOT NULL,
    NRGNAME VARCHAR (32)  NOT NULL,
    NRGSEX VARCHAR (2)  NOT NULL,
    NRGADDER VARCHAR (256)  NOT NULL,
    NRGPHONE VARCHAR (128)  NOT NULL,
    NRGEMAIL VARCHAR (128)  NOT NULL,
    NRGPERID VARCHAR (128)  NOT NULL,
    NRGDATE VARCHAR (8)  NOT NULL,
    NRGSTATUS VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWNRG ADD
    CONSTRAINT PK_FDWNRG PRIMARY KEY
    (
        NRGID
    );

/******************************************
FDWNRL   网上查询业主查询关联表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWNRL]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWNRL];
CREATE TABLE [dbo].[FDWNRL] (
    NRLNRGID VARCHAR (32)  NOT NULL,
    NRLHOUID VARCHAR (32)  NOT NULL,
    NRLHOUQRYPWD VARCHAR (32)  NOT NULL
);

ALTER TABLE FDWNRL ADD
    CONSTRAINT PK_FDWNRL PRIMARY KEY
    (
        NRLHOUID,
        NRLHOUQRYPWD
    );

/******************************************
FDWVOT   网上调查表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWVOT]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWVOT];
CREATE TABLE [dbo].[FDWVOT] (
    VOTID VARCHAR (32)  NOT NULL,
    VOTNAME VARCHAR (64)  NOT NULL,
    VOTSTATUS VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWVOT ADD
    CONSTRAINT PK_FDWVOT PRIMARY KEY
    (
        VOTID
    );

/******************************************
FDWVIT   网上调查选项表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWVIT]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWVIT];
CREATE TABLE [dbo].[FDWVIT] (
    VITID VARCHAR (32)  NOT NULL,
    VITVOTID VARCHAR (32)  NOT NULL,
    VITNAME VARCHAR (64)  NOT NULL,
    VITCOUNT INT  NOT NULL
);

ALTER TABLE FDWVIT ADD
    CONSTRAINT PK_FDWVIT PRIMARY KEY
    (
        VITID
    );

/******************************************
FDWLNK   网上查询连接表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWLNK]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWLNK];
CREATE TABLE [dbo].[FDWLNK] (
    LNKID VARCHAR (32)  NOT NULL,
    LNKNAME VARCHAR (64)  NOT NULL,
    LNKSRC VARCHAR (64)  NOT NULL
);

ALTER TABLE FDWLNK ADD
    CONSTRAINT PK_FDWLNK PRIMARY KEY
    (
        LNKID
    );

/******************************************
FDWCLN   网上查询相关投诉表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWCLN]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWCLN];
CREATE TABLE [dbo].[FDWCLN] (
    CLNID VARCHAR (32)  NOT NULL,
    CLNNAME VARCHAR (256)  NOT NULL,
    CLNDESC TEXT  NOT NULL,
    CLNCAUSE TEXT  NOT NULL,
    CLNMBDID VARCHAR (32)  NOT NULL,
    CLNSUBDATE VARCHAR (8)  NOT NULL,
    CLNSOLMBDID VARCHAR (32)  NOT NULL,
    CLNSOLDATE VARCHAR (8)  NOT NULL,
    CLNSOLDESC TEXT  NOT NULL,
    CLNSTATUS VARCHAR (1)  NOT NULL,
    CLNSRQID VARCHAR (32)  NOT NULL,
    CLNPUBLISH VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWCLN ADD
    CONSTRAINT PK_FDWCLN PRIMARY KEY
    (
        CLNID
    );

/******************************************
FDWDWN   网上查询下载表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWDWN]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWDWN];
CREATE TABLE [dbo].[FDWDWN] (
    DWNID VARCHAR (32)  NOT NULL,
    DWNNAME VARCHAR (32)  NOT NULL,
    DWNDATE VARCHAR (8)  NOT NULL,
    DWNTIME VARCHAR (6)  NOT NULL,
    DWNSTATUS VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWDWN ADD
    CONSTRAINT PK_FDWDWN PRIMARY KEY
    (
        DWNID
    );

/******************************************
FDWADV   网上查询广告表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWADV]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWADV];
CREATE TABLE [dbo].[FDWADV] (
    ADVID VARCHAR (32)  NOT NULL,
    ADVNAME VARCHAR (100)  NOT NULL,
    ADVSHOW VARCHAR (1)  NOT NULL,
    ADVPOSITION VARCHAR (1)  NOT NULL,
    ADVREGDATE VARCHAR (8)  NOT NULL,
    ADVTIME VARCHAR (6)  NOT NULL,
    ADVHTTP VARCHAR (100)  NOT NULL
);

ALTER TABLE FDWADV ADD
    CONSTRAINT PK_FDWADV PRIMARY KEY
    (
        ADVID
    );

/******************************************
FDWSEC   物业小区表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSEC]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSEC];
CREATE TABLE [dbo].[FDWSEC] (
    SECID VARCHAR (32)  NOT NULL,
    SECRTQNAME VARCHAR (50)  NOT NULL,
    SECDTRID VARCHAR (32)  NOT NULL,
    SECSTRID VARCHAR (32)  NOT NULL,
    SECNUM VARCHAR (16)  NOT NULL,
    SECFULLNUM VARCHAR (48)  NOT NULL,
    SECCODE VARCHAR (64)  NOT NULL
);

ALTER TABLE FDWSEC ADD
    CONSTRAINT PK_FDWSEC PRIMARY KEY
    (
        SECID
    );

/******************************************
FDWCST   统计编码表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWCST]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWCST];
CREATE TABLE [dbo].[FDWCST] (
    CSTCTPNAME VARCHAR (32)  NOT NULL,
    CSTNAME VARCHAR (64)  NOT NULL,
    CSTNO INT  NOT NULL
);

ALTER TABLE FDWCST ADD
    CONSTRAINT PK_FDWCST PRIMARY KEY
    (
        CSTCTPNAME,
        CSTNAME
    );

/******************************************
FDWCTT   编码类别表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWCTT]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWCTT];
CREATE TABLE [dbo].[FDWCTT] (
    CTTNAME VARCHAR (64)  NOT NULL,
    CTTTYPE VARCHAR (1)  NOT NULL,
    CTTFUNID VARCHAR (32)  NOT NULL,
    CTTORGTYPE VARCHAR (8)  NOT NULL,
    CTTCSTFLAG VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWCTT ADD
    CONSTRAINT PK_FDWCTT PRIMARY KEY
    (
        CTTNAME
    );

/******************************************
FDWPRG   参数可用表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPRG]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPRG];
CREATE TABLE [dbo].[FDWPRG] (
    PRGPARNAME VARCHAR (64)  NOT NULL,
    PRGVALUE VARCHAR (128)  NOT NULL
);

ALTER TABLE FDWPRG ADD
    CONSTRAINT PK_FDWPRG PRIMARY KEY
    (
        PRGPARNAME,
        PRGVALUE
    );

/******************************************
FDWCDE   编号表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWCDE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWCDE];
CREATE TABLE [dbo].[FDWCDE] (
    CDEOWNERID VARCHAR (32)  NOT NULL,
    CDEPRE VARCHAR (16)  NOT NULL,
    CDETYPE VARCHAR (8)  NOT NULL,
    CDEVALUE INT  NOT NULL
);

ALTER TABLE FDWCDE ADD
    CONSTRAINT PK_FDWCDE PRIMARY KEY
    (
        CDEOWNERID,
        CDEPRE,
        CDETYPE
    );

/******************************************
FDWPVV   参数表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPVV]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPVV];
CREATE TABLE [dbo].[FDWPVV] (
    PVVPARNAME VARCHAR (64)  NOT NULL,
    PVVPROPERTY VARCHAR (1)  NOT NULL,
    PVVOWNER VARCHAR (64)  NOT NULL,
    PVVVALUE VARCHAR (128)  NOT NULL
);

ALTER TABLE FDWPVV ADD
    CONSTRAINT PK_FDWPVV PRIMARY KEY
    (
        PVVPARNAME,
        PVVPROPERTY,
        PVVOWNER
    );

/******************************************
FDWBNL   银行账户流水表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWBNL]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWBNL];
CREATE TABLE [dbo].[FDWBNL] (
    BNLID VARCHAR (32)  NOT NULL,
    BNLBNKID VARCHAR (32)  NOT NULL,
    BNLLISID VARCHAR (32)  NOT NULL,
    BNLPAYPROPER VARCHAR (20)  NOT NULL,
    BNLTYPE VARCHAR (10)  NOT NULL,
    BNLDESC VARCHAR (50)  NOT NULL,
    BNLPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    BNLACCDATE VARCHAR (8)  NOT NULL,
    BNLENTERDATE VARCHAR (8)  NOT NULL,
    BNLPAYREMARK VARCHAR (200)  NOT NULL
);

ALTER TABLE FDWBNL ADD
    CONSTRAINT PK_FDWBNL PRIMARY KEY
    (
        BNLID
    );

/******************************************
FDWPFN   竣工表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPFN]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPFN];
CREATE TABLE [dbo].[FDWPFN] (
    PFNID VARCHAR (32)  NOT NULL,
    PFNNAME VARCHAR (50)  NOT NULL,
    PFNBDRID VARCHAR (32)  NOT NULL,
    PFNSRQID VARCHAR (32)  NOT NULL,
    PFNBDROPER VARCHAR (20)  NOT NULL,
    PFNMNGOPER VARCHAR (32)  NOT NULL,
    PFNOFCLOC VARCHAR (512)  NOT NULL,
    PFNOFCAREA DECIMAL (15, 4)  NOT NULL,
    PFNOFCFACTAREA DECIMAL (15, 4)  NOT NULL,
    PFNBUSLOC VARCHAR (512)  NOT NULL,
    PFNBUSAREA DECIMAL (15, 4)  NOT NULL,
    PFNBUSFACTAREA DECIMAL (15, 4)  NOT NULL,
    PFNPAYID VARCHAR (32)  NOT NULL,
    PFNBASE VARCHAR (16)  NOT NULL,
    PFNUNDAREA DECIMAL (15, 4)  NOT NULL
);

ALTER TABLE FDWPFN ADD
    CONSTRAINT PK_FDWPFN PRIMARY KEY
    (
        PFNID
    );

/******************************************
FDWPAR   参数描述表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPAR]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPAR];
CREATE TABLE [dbo].[FDWPAR] (
    PARNAME VARCHAR (64)  NOT NULL,
    PARPROPERTY VARCHAR (10)  NOT NULL,
    PARMEMO VARCHAR (100)  NOT NULL,
    PARINPFLG VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWPAR ADD
    CONSTRAINT PK_FDWPAR PRIMARY KEY
    (
        PARNAME
    );

/******************************************
FDWCOO   编码表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWCOO]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWCOO];
CREATE TABLE [dbo].[FDWCOO] (
    COOORGID VARCHAR (20)  NOT NULL,
    COOCTPNAME VARCHAR (32)  NOT NULL,
    COONAME VARCHAR (32)  NOT NULL,
    COONO INT  NOT NULL,
    COOCSTNAME VARCHAR (64)  NOT NULL,
    COOSTATUS VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWCOO ADD
    CONSTRAINT PK_FDWCOO PRIMARY KEY
    (
        COOORGID,
        COOCTPNAME,
        COONAME
    );

/******************************************
FDWFTK   收件管理表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWFTK]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWFTK];
CREATE TABLE [dbo].[FDWFTK] (
    FTKID VARCHAR (32)  NOT NULL,
    FTKBDRNAME VARCHAR (100)  NOT NULL,
    FTKSECNAME VARCHAR (50)  NOT NULL,
    FTKNAME VARCHAR (50)  NOT NULL,
    FTKTAKEDATE VARCHAR (8)  NOT NULL,
    FTKTAKENAME VARCHAR (32)  NOT NULL,
    FTKSENDERNAME VARCHAR (32)  NOT NULL,
    FTKTAKETYPE VARCHAR (20)  NOT NULL,
    FTKCOUNT INT  NOT NULL
);

ALTER TABLE FDWFTK ADD
    CONSTRAINT PK_FDWFTK PRIMARY KEY
    (
        FTKID
    );

/******************************************
FDWRLS   报表明细表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWRLS]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWRLS];
CREATE TABLE [dbo].[FDWRLS] (
    RLSORGID VARCHAR (32)  NOT NULL,
    RLSRPTTYPE VARCHAR (1)  NOT NULL,
    RLSRPTNUM VARCHAR (4)  NOT NULL,
    RLSDATE VARCHAR (8)  NOT NULL,
    RLSCRDATE VARCHAR (8)  NOT NULL,
    RLSCRTIME VARCHAR (6)  NOT NULL,
    RLSUSRNAME VARCHAR (32)  NOT NULL
);

ALTER TABLE FDWRLS ADD
    CONSTRAINT PK_FDWRLS PRIMARY KEY
    (
        RLSORGID,
        RLSRPTTYPE,
        RLSRPTNUM,
        RLSDATE
    );

/******************************************
FDWFTD   收件管理明细表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWFTD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWFTD];
CREATE TABLE [dbo].[FDWFTD] (
    FTDID VARCHAR (32)  NOT NULL,
    FTDFTKID VARCHAR (32)  NOT NULL,
    FTDNAME VARCHAR (120)  NOT NULL,
    FTDCOUNT INT  NOT NULL,
    FTDTYPE VARCHAR (20)  NOT NULL
);

ALTER TABLE FDWFTD ADD
    CONSTRAINT PK_FDWFTD PRIMARY KEY
    (
        FTDID
    );

/******************************************
FDWSTT   查询统计类型表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSTT]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSTT];
CREATE TABLE [dbo].[FDWSTT] (
    STTID VARCHAR (32)  NOT NULL,
    STTNAME VARCHAR (64)  NOT NULL,
    STTFUNID VARCHAR (32)  NOT NULL,
    STTCHARCT VARCHAR (64)  NOT NULL,
    STTTRANID VARCHAR (64)  NOT NULL
);

ALTER TABLE FDWSTT ADD
    CONSTRAINT PK_FDWSTT PRIMARY KEY
    (
        STTID
    );

/******************************************
FDWSTF   查询统计字段表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSTF]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSTF];
CREATE TABLE [dbo].[FDWSTF] (
    STFSTTID VARCHAR (32)  NOT NULL,
    STFID VARCHAR (32)  NOT NULL,
    STFNAME VARCHAR (64)  NOT NULL,
    STFTYPE VARCHAR (10)  NOT NULL,
    STFDATATYPE VARCHAR (1)  NOT NULL,
    STFSUBLEN INT  NOT NULL,
    STFMINVAL VARCHAR (20)  NOT NULL,
    STFMAXVAL VARCHAR (20)  NOT NULL,
    STFSTM VARCHAR (1)  NOT NULL,
    STFQCM VARCHAR (1)  NOT NULL,
    STFCHCODE VARCHAR (20)  NOT NULL,
    STFCHTRANID VARCHAR (64)  NOT NULL
);

ALTER TABLE FDWSTF ADD
    CONSTRAINT PK_FDWSTF PRIMARY KEY
    (
        STFSTTID,
        STFID
    );

/******************************************
FDWOST   单位可用查询统计类型表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWOST]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWOST];
CREATE TABLE [dbo].[FDWOST] (
    OSTORGID VARCHAR (32)  NOT NULL,
    OSTSTTID VARCHAR (32)  NOT NULL
);

ALTER TABLE FDWOST ADD
    CONSTRAINT PK_FDWOST PRIMARY KEY
    (
        OSTORGID,
        OSTSTTID
    );

/******************************************
FDWCOM   新旧编号对照表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWCOM]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWCOM];
CREATE TABLE [dbo].[FDWCOM] (
    COMTABNAME VARCHAR (10)  NOT NULL,
    COMNEWID VARCHAR (32)  NOT NULL,
    COMOLDID VARCHAR (32)  NOT NULL
);

ALTER TABLE FDWCOM ADD
    CONSTRAINT PK_FDWCOM PRIMARY KEY
    (
        COMNEWID
    );

/******************************************
FDWCNM   新旧编号表名表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWCNM]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWCNM];
CREATE TABLE [dbo].[FDWCNM] (
    CNMCOMTABNAME VARCHAR (10)  NOT NULL,
    CNMCNAME VARCHAR (32)  NOT NULL,
    CNMNO INT  NOT NULL
);

ALTER TABLE FDWCNM ADD
    CONSTRAINT PK_FDWCNM PRIMARY KEY
    (
        CNMCOMTABNAME
    );

/******************************************
FDWSBR   苏州银行接口对账记录表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSBR]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSBR];
CREATE TABLE [dbo].[FDWSBR] (
    SBRDATE VARCHAR (8)  NOT NULL,
    SBRTIME VARCHAR (6)  NOT NULL,
    SBRTYPE VARCHAR (16)  NOT NULL,
    SBRNAME VARCHAR (100)  NOT NULL,
    SBRLINEID VARCHAR (32)  NOT NULL,
    SBRAMOUNT DECIMAL (18, 2)  NOT NULL,
    SBROPER VARCHAR (16)  NOT NULL,
    SBRBNKID VARCHAR (32)  NOT NULL
);

ALTER TABLE FDWSBR ADD
    CONSTRAINT PK_FDWSBR PRIMARY KEY
    (
        SBRDATE,
        SBRTIME,
        SBRLINEID
    );

/******************************************
FDWTTT   交易流水汇总数据视图
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWTTT]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWTTT];
CREATE TABLE [dbo].[FDWTTT] (
    TTTID VARCHAR (32)  NOT NULL,
    TTTMBDTYPE VARCHAR (20)  NOT NULL,
    TTTMBDID VARCHAR (32)  NOT NULL,
    TTTMBDNAME VARCHAR (50)  NOT NULL,
    TTTPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    TTTSTATUS VARCHAR (1)  NOT NULL,
    TTTTYPE VARCHAR (20)  NOT NULL,
    TTTINFO VARCHAR (20)  NOT NULL,
    TTTREGUSR VARCHAR (20)  NOT NULL,
    TTTREGDATE VARCHAR (8)  NOT NULL,
    TTTCHKUSR VARCHAR (20)  NOT NULL,
    TTTCHKDATE VARCHAR (8)  NOT NULL,
    TTTACCDATE VARCHAR (8)  NOT NULL,
    TTTBNKID VARCHAR (32)  NOT NULL,
    TTTREMARK VARCHAR (200)  NOT NULL,
    TTTPROPER VARCHAR (20)  NOT NULL
);

ALTER TABLE FDWTTT ADD
    CONSTRAINT PK_FDWTTT PRIMARY KEY
    (
        TTTID
    );

/******************************************
FDWLBU   联网银行柜员表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWLBU]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWLBU];
CREATE TABLE [dbo].[FDWLBU] (
    LBUBNKID VARCHAR (32)  NOT NULL,
    LBUID VARCHAR (16)  NOT NULL,
    LBUNAME VARCHAR (32)  NOT NULL,
    LBUPASSWD VARCHAR (16)  NOT NULL,
    LBURIGHT VARCHAR (16)  NOT NULL,
    LBUDISABLE VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWLBU ADD
    CONSTRAINT PK_FDWLBU PRIMARY KEY
    (
        LBUBNKID,
        LBUID
    );

/******************************************
FDWLBL   联网银行流水表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWLBL]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWLBL];
CREATE TABLE [dbo].[FDWLBL] (
    LBLBNKID VARCHAR (32)  NOT NULL,
    LBLDATE VARCHAR (8)  NOT NULL,
    LBLSEQNO INT  NOT NULL,
    LBLLBUID VARCHAR (16)  NOT NULL,
    LBLLBUNAME VARCHAR (32)  NOT NULL,
    LBLPAYID VARCHAR (32)  NOT NULL,
    LBLPAYMBDNAME VARCHAR (100)  NOT NULL,
    LBLACTION INT  NOT NULL,
    LBLAMOUNT DECIMAL (15, 2)  NOT NULL
);

ALTER TABLE FDWLBL ADD
    CONSTRAINT PK_FDWLBL PRIMARY KEY
    (
        LBLBNKID,
        LBLDATE,
        LBLSEQNO
    );

/******************************************
FDWLCA   联网银行对账数据表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWLCA]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWLCA];
CREATE TABLE [dbo].[FDWLCA] (
    LCABNKID VARCHAR (32)  NOT NULL,
    LCADATE VARCHAR (8)  NOT NULL,
    LCASEQNO INT  NOT NULL,
    LCASYSPOSAMT DECIMAL (15, 2)  NOT NULL,
    LCASYSPOSCNT INT  NOT NULL,
    LCASYSNEGAMT DECIMAL (15, 2)  NOT NULL,
    LCASYSNEGCNT INT  NOT NULL,
    LCABNKPOSAMT DECIMAL (15, 2)  NOT NULL,
    LCABNKPOSCNT INT  NOT NULL,
    LCABNKNEGAMT DECIMAL (15, 2)  NOT NULL,
    LCABNKNEGCNT INT  NOT NULL,
    LCARESULT VARCHAR (1)  NOT NULL,
    LCAOPDATE VARCHAR (8)  NOT NULL,
    LCAOPTIME VARCHAR (6)  NOT NULL,
    LCALBUID VARCHAR (16)  NOT NULL,
    LCALBUNAME VARCHAR (32)  NOT NULL
);

ALTER TABLE FDWLCA ADD
    CONSTRAINT PK_FDWLCA PRIMARY KEY
    (
        LCABNKID,
        LCADATE,
        LCASEQNO
    );

/******************************************
FDWTTD   交易流水明细汇总数据视图
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWTTD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWTTD];
CREATE TABLE [dbo].[FDWTTD] (
    TTDID VARCHAR (32)  NOT NULL,
    TTDNAME VARCHAR (50)  NOT NULL,
    TTDSTYLE VARCHAR (32)  NOT NULL,
    TTDTTTID VARCHAR (32)  NOT NULL,
    TTDMBDID VARCHAR (32)  NOT NULL,
    TTDMBDNAME VARCHAR (50)  NOT NULL,
    TTDMBDTYPE VARCHAR (20)  NOT NULL,
    TTDTTTINFO VARCHAR (20)  NOT NULL,
    TTDPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    TTDBNKID VARCHAR (32)  NOT NULL,
    TTDACCDATE VARCHAR (8)  NOT NULL,
    TTDSTATUS VARCHAR (1)  NOT NULL,
    TTDREGUSR VARCHAR (20)  NOT NULL,
    TTDREGDATE VARCHAR (8)  NOT NULL,
    TTDCHKUSR VARCHAR (20)  NOT NULL,
    TTDCHKDATE VARCHAR (8)  NOT NULL,
    TTDREMARK VARCHAR (200)  NOT NULL,
    TTDTYPE VARCHAR (20)  NOT NULL,
    TTDPROPER VARCHAR (20)  NOT NULL,
    TTDNAME2 VARCHAR (50)  NOT NULL,
    TTDAREA DECIMAL (15, 2)  NOT NULL,
    TTDWITHCOMP VARCHAR (50)  NOT NULL
);

ALTER TABLE FDWTTD ADD
    CONSTRAINT PK_FDWTTD PRIMARY KEY
    (
        TTDID,
        TTDTTTID
    );

/******************************************
FDWSET   系统设置表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSET]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSET];
CREATE TABLE [dbo].[FDWSET] (
    SETORGID VARCHAR (20)  NOT NULL,
    SETITEM VARCHAR (128)  NOT NULL,
    SETACTKIND VARCHAR (10)  NOT NULL,
    SETVALUE VARCHAR (32)  NOT NULL,
    SETVALUEDISP VARCHAR (128)  NOT NULL,
    SETFLAGE VARCHAR (1)  NOT NULL,
    SETEXPLAIN VARCHAR (512)  NOT NULL
);

ALTER TABLE FDWSET ADD
    CONSTRAINT PK_FDWSET PRIMARY KEY
    (
        SETORGID,
        SETITEM,
        SETACTKIND
    );

/******************************************
FDWACR   结息范围表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWACR]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWACR];
CREATE TABLE [dbo].[FDWACR] (
    ACRACCID VARCHAR (32)  NOT NULL,
    ACRACTMBDTYPE VARCHAR (20)  NOT NULL,
    ACRACTKIND VARCHAR (32)  NOT NULL
);

ALTER TABLE FDWACR ADD
    CONSTRAINT PK_FDWACR PRIMARY KEY
    (
        ACRACCID,
        ACRACTMBDTYPE,
        ACRACTKIND
    );

/******************************************
FDWOIF   单位资料表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWOIF]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWOIF];
CREATE TABLE [dbo].[FDWOIF] (
    OIFID VARCHAR (32)  NOT NULL,
    OIFNAME VARCHAR (256)  NOT NULL,
    OIFTYPE VARCHAR (32)  NOT NULL,
    OIFBRIEF VARCHAR (1024)  NOT NULL,
    OIFPUTFILE VARCHAR (256)  NOT NULL,
    OIFPUTDATE VARCHAR (8)  NOT NULL
);

ALTER TABLE FDWOIF ADD
    CONSTRAINT PK_FDWOIF PRIMARY KEY
    (
        OIFID
    );

/******************************************
FDWBXM   银行流水账表（厦门）
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWBXM]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWBXM];
CREATE TABLE [dbo].[FDWBXM] (
    BXMID VARCHAR (32)  NOT NULL,
    BXMBNKNAME VARCHAR (50)  NOT NULL,
    BXMTYPE VARCHAR (20)  NOT NULL,
    BXMINOUT VARCHAR (4)  NOT NULL,
    BXMITEMDESC VARCHAR (100)  NOT NULL,
    BXMMBDNAME VARCHAR (100)  NOT NULL,
    BXMPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    BXMACCRUAL DECIMAL (15, 2)  NOT NULL,
    BXMVOUCHERNO VARCHAR (20)  NOT NULL,
    BXMDATE VARCHAR (8)  NOT NULL,
    BXMREGDATE VARCHAR (8)  NOT NULL,
    BXMREGUSR VARCHAR (15)  NOT NULL,
    BXMSTATUS VARCHAR (1)  NOT NULL,
    BXMMARK VARCHAR (200)  NOT NULL
);

ALTER TABLE FDWBXM ADD
    CONSTRAINT PK_FDWBXM PRIMARY KEY
    (
        BXMID
    );

/******************************************
FDWSAC   特殊结息记录表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSAC]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSAC];
CREATE TABLE [dbo].[FDWSAC] (
    SACID VARCHAR (32)  NOT NULL,
    SACACCID VARCHAR (32)  NOT NULL,
    SACNO INT  NOT NULL,
    SACRATE DECIMAL (9, 4)  NOT NULL,
    SACRATE1 DECIMAL (9, 4)  NOT NULL,
    SACACTNUM INT  NOT NULL,
    SACINIBAL DECIMAL (18, 2)  NOT NULL,
    SACENDBAL DECIMAL (18, 2)  NOT NULL,
    SACTOTALACTNUM INT  NOT NULL,
    SACTOTALINIBAL DECIMAL (18, 2)  NOT NULL,
    SACENDBALANCE DECIMAL (18, 2)  NOT NULL,
    SACAMOUNT DECIMAL (18, 2)  NOT NULL,
    SACPRODUCT DECIMAL (18, 2)  NOT NULL,
    SACFACTACCR DECIMAL (18, 2)  NOT NULL,
    SACACTAMOUNT DECIMAL (18, 2)  NOT NULL,
    SACACCEXP DECIMAL (18, 2)  NOT NULL
);

ALTER TABLE FDWSAC ADD
    CONSTRAINT PK_FDWSAC PRIMARY KEY
    (
        SACID
    );

/******************************************
FDWSAD   特殊结息明细表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSAD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSAD];
CREATE TABLE [dbo].[FDWSAD] (
    SADSACID VARCHAR (32)  NOT NULL,
    SADACTNO VARCHAR (32)  NOT NULL,
    SADACTMBDTYPE VARCHAR (20)  NOT NULL,
    SADREPOSE VARCHAR (200)  NOT NULL
);

ALTER TABLE FDWSAD ADD
    CONSTRAINT PK_FDWSAD PRIMARY KEY
    (
        SADSACID,
        SADACTNO
    );

/******************************************
FDWPSH   缴款标准变更历史
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPSH]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPSH];
CREATE TABLE [dbo].[FDWPSH] (
    PSHID VARCHAR (32)  NOT NULL,
    PSHPSDID VARCHAR (32)  NOT NULL,
    PSHDESC VARCHAR (128)  NOT NULL,
    PSHCHGDATE VARCHAR (8)  NOT NULL,
    PSHCHGTIME VARCHAR (6)  NOT NULL,
    PSHCHGUSR VARCHAR (32)  NOT NULL
);

ALTER TABLE FDWPSH ADD
    CONSTRAINT PK_FDWPSH PRIMARY KEY
    (
        PSHID
    );

/******************************************
FDWHPB   房屋新开户缴款批量导入记录表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWHPB]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWHPB];
CREATE TABLE [dbo].[FDWHPB] (
    HPBID VARCHAR (32)  NOT NULL,
    HPBSRQID VARCHAR (50)  NOT NULL,
    HPBBDRID VARCHAR (32)  NOT NULL,
    HPBEMCID VARCHAR (32)  NOT NULL,
    HPBOCCID VARCHAR (32)  NOT NULL,
    HPBVNDID VARCHAR (32)  NOT NULL,
    HPBPAYPROPER VARCHAR (20)  NOT NULL,
    HPBBLDCNT INT  NOT NULL,
    HPBHOUCNT INT  NOT NULL,
    HPBHOUAREA DECIMAL (15, 4)  NOT NULL,
    HPBPAYPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    HPBPAYACCRUAL DECIMAL (15, 2)  NOT NULL,
    HPBPAYBNKID VARCHAR (32)  NOT NULL,
    HPBREGDATE VARCHAR (8)  NOT NULL,
    HPBREGUSR VARCHAR (32)  NOT NULL,
    HPBCHKDATE VARCHAR (8)  NOT NULL,
    HPBCHKUSR VARCHAR (32)  NOT NULL,
    HPBBATSERNO VARCHAR (30)  NOT NULL,
    HPBPAYSTATUS VARCHAR (1)  NOT NULL,
    HPBPAYREMARK VARCHAR (200)  NOT NULL,
    HPBCHKPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    HPBCHKACCRUAL DECIMAL (15, 2)  NOT NULL,
    HPBCHKHOUCNT INT  NOT NULL,
    HPBDTRID VARCHAR (32)  NOT NULL,
    HPBINFODESC VARCHAR (100)  NOT NULL
);

ALTER TABLE FDWHPB ADD
    CONSTRAINT PK_FDWHPB PRIMARY KEY
    (
        HPBID
    );

/******************************************
FDWNOH   编号操作历史表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWNOH]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWNOH];
CREATE TABLE [dbo].[FDWNOH] (
    NOHID VARCHAR (32)  NOT NULL,
    NOHMBDTYPE VARCHAR (20)  NOT NULL,
    NOHMBDID VARCHAR (32)  NOT NULL,
    NOHDATE VARCHAR (8)  NOT NULL,
    NOHTIME VARCHAR (6)  NOT NULL,
    NOHUSER VARCHAR (32)  NOT NULL,
    NOHDESC VARCHAR (128)  NOT NULL
);

ALTER TABLE FDWNOH ADD
    CONSTRAINT PK_FDWNOH PRIMARY KEY
    (
        NOHID
    );

/******************************************
FDWNOD   编号操作历史明细表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWNOD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWNOD];
CREATE TABLE [dbo].[FDWNOD] (
    NODID VARCHAR (32)  NOT NULL,
    NODNOHID VARCHAR (32)  NOT NULL,
    NODMBDTYPE VARCHAR (20)  NOT NULL,
    NODMBDID VARCHAR (32)  NOT NULL,
    NODOLDNUM VARCHAR (32)  NOT NULL,
    NODNEWNUM VARCHAR (32)  NOT NULL
);

ALTER TABLE FDWNOD ADD
    CONSTRAINT PK_FDWNOD PRIMARY KEY
    (
        NODID
    );

/******************************************
FDWLBP   银行客户端参数表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWLBP]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWLBP];
CREATE TABLE [dbo].[FDWLBP] (
    LBPBNKID VARCHAR (32)  NOT NULL,
    LBPIP VARCHAR (16)  NOT NULL,
    LBPMASK VARCHAR (16)  NOT NULL
);

ALTER TABLE FDWLBP ADD
    CONSTRAINT PK_FDWLBP PRIMARY KEY
    (
        LBPBNKID,
        LBPIP,
        LBPMASK
    );

/******************************************
FDWCOB   并户记录表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWCOB]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWCOB];
CREATE TABLE [dbo].[FDWCOB] (
    COBID VARCHAR (32)  NOT NULL,
    COBNO INT  NOT NULL,
    COBMBDTYPE VARCHAR (20)  NOT NULL,
    COBINMBDID VARCHAR (32)  NOT NULL,
    COBINMBDNAME VARCHAR (100)  NOT NULL,
    COBINMBDPRINC DECIMAL (15, 2)  NOT NULL,
    COBINMBDACCR DECIMAL (15, 2)  NOT NULL,
    COBOUTMBDID VARCHAR (32)  NOT NULL,
    COBOUTMBDNAME VARCHAR (100)  NOT NULL,
    COBOUTMBDPRINC DECIMAL (15, 2)  NOT NULL,
    COBOUTMBDACCR DECIMAL (15, 2)  NOT NULL,
    COBDATE VARCHAR (8)  NOT NULL,
    COBUSR VARCHAR (32)  NOT NULL
);

ALTER TABLE FDWCOB ADD
    CONSTRAINT PK_FDWCOB PRIMARY KEY
    (
        COBID,
        COBNO
    );

/******************************************
FDWCDD   并户账户明细表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWCDD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWCDD];
CREATE TABLE [dbo].[FDWCDD] (
    CDDCOBID VARCHAR (32)  NOT NULL,
    CDDACLID VARCHAR (32)  NOT NULL,
    CDDCOBMBDID VARCHAR (32)  NOT NULL,
    CDDACLTYPE VARCHAR (10)  NOT NULL,
    CDDACLDESC VARCHAR (50)  NOT NULL,
    CDDACLPRINC DECIMAL (15, 2)  NOT NULL,
    CDDACLACCRUAL DECIMAL (15, 2)  NOT NULL,
    CDDACLACCDATE VARCHAR (8)  NOT NULL,
    CDDACLENTERDATE VARCHAR (8)  NOT NULL,
    CDDACLCHKUSR VARCHAR (32)  NOT NULL,
    CDDACLREMARK VARCHAR (200)  NOT NULL
);

ALTER TABLE FDWCDD ADD
    CONSTRAINT PK_FDWCDD PRIMARY KEY
    (
        CDDCOBID,
        CDDACLID,
        CDDCOBMBDID
    );

/******************************************
FDWPAC   保修金账户表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPAC]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPAC];
CREATE TABLE [dbo].[FDWPAC] (
    PACID VARCHAR (32)  NOT NULL,
    PACMBDTYPE VARCHAR (20)  NOT NULL,
    PACMBDID VARCHAR (32)  NOT NULL,
    PACKIND VARCHAR (10)  NOT NULL,
    PACBNKID VARCHAR (32)  NOT NULL,
    PACBNKACTNO VARCHAR (30)  NOT NULL,
    PACPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    PACPRINCIPALTOT DECIMAL (15, 2)  NOT NULL,
    PACACCRUAL DECIMAL (15, 2)  NOT NULL,
    PACACCRUALTOT DECIMAL (15, 2)  NOT NULL,
    PACFROMONEY DECIMAL (15, 2)  NOT NULL,
    PACDEPDATE VARCHAR (8)  NOT NULL,
    PACDEPDPSN VARCHAR (20)  NOT NULL,
    PACPCCDATE VARCHAR (8)  NOT NULL,
    PACSTATUS VARCHAR (1)  NOT NULL,
    PACDESTROYDATE VARCHAR (8)  NOT NULL
);

ALTER TABLE FDWPAC ADD
    CONSTRAINT PK_FDWPAC PRIMARY KEY
    (
        PACID
    );

/******************************************
FDWPAL   保修金账户流水表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPAL]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPAL];
CREATE TABLE [dbo].[FDWPAL] (
    PALID VARCHAR (32)  NOT NULL,
    PALPACID VARCHAR (32)  NOT NULL,
    PALPPYID VARCHAR (32)  NOT NULL,
    PALTYPE VARCHAR (10)  NOT NULL,
    PALPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    PALACCRUAL DECIMAL (15, 2)  NOT NULL,
    PALACCDATE VARCHAR (8)  NOT NULL,
    PALDESC VARCHAR (200)  NOT NULL,
    PALENTERDATE VARCHAR (8)  NOT NULL,
    PALCHKUSR VARCHAR (32)  NOT NULL,
    PALREMARK VARCHAR (200)  NOT NULL
);

ALTER TABLE FDWPAL ADD
    CONSTRAINT PK_FDWPAL PRIMARY KEY
    (
        PALID
    );

/******************************************
FDWPTN   保修金使用划拨流水表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPTN]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPTN];
CREATE TABLE [dbo].[FDWPTN] (
    PTNID VARCHAR (32)  NOT NULL,
    PTNPPLID VARCHAR (32)  NOT NULL,
    PTNNO INT  NOT NULL,
    PTNDATE VARCHAR (8)  NOT NULL,
    PTNAMT DECIMAL (15, 2)  NOT NULL,
    PTNSTATUS VARCHAR (1)  NOT NULL,
    PTNYHSUSER VARCHAR (50)  NOT NULL,
    PTNYHSCOMPANY VARCHAR (100)  NOT NULL,
    PTNYHSDATE VARCHAR (8)  NOT NULL,
    PTNYHSTIME VARCHAR (6)  NOT NULL,
    PTNYHSCOMMENT VARCHAR (2000)  NOT NULL
);

ALTER TABLE FDWPTN ADD
    CONSTRAINT PK_FDWPTN PRIMARY KEY
    (
        PTNID
    );

/******************************************
FDWPCC   保修金结息记录表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPCC]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPCC];
CREATE TABLE [dbo].[FDWPCC] (
    PCCID VARCHAR (32)  NOT NULL,
    PCCCALDATE VARCHAR (8)  NOT NULL,
    PCCOPDATE VARCHAR (8)  NOT NULL,
    PCCRATE DECIMAL (9, 4)  NOT NULL,
    PCCRATE1 DECIMAL (9, 4)  NOT NULL,
    PCCVNDFIXRATE DECIMAL (9, 4)  NOT NULL,
    PCCACTRNG VARCHAR (512)  NOT NULL,
    PCCACTNUM INT  NOT NULL,
    PCCINIBAL DECIMAL (18, 2)  NOT NULL,
    PCCENDBAL DECIMAL (18, 2)  NOT NULL,
    PCCTOTALACTNUM INT  NOT NULL,
    PCCTOTALINIBAL DECIMAL (18, 2)  NOT NULL,
    PCCENDBALANCE DECIMAL (18, 2)  NOT NULL,
    PCCOPERUSR VARCHAR (32)  NOT NULL,
    PCCAMOUNT DECIMAL (18, 2)  NOT NULL,
    PCCPRODUCT DECIMAL (18, 2)  NOT NULL,
    PCCFACTACCR DECIMAL (18, 2)  NOT NULL,
    PCCEXP DECIMAL (18, 2)  NOT NULL,
    PCCACTAMOUNT DECIMAL (18, 2)  NOT NULL,
    PCCSTATUS INT  NOT NULL,
    PCCSACNUM INT  NOT NULL
);

ALTER TABLE FDWPCC ADD
    CONSTRAINT PK_FDWPCC PRIMARY KEY
    (
        PCCID
    );

/******************************************
FDWPCD   保修金结息记录明细表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPCD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPCD];
CREATE TABLE [dbo].[FDWPCD] (
    PCDPCCID VARCHAR (32)  NOT NULL,
    PCDPACID VARCHAR (32)  NOT NULL,
    PCDPCTMBDTYPE VARCHAR (32)  NOT NULL,
    PCDAMOUNT DECIMAL (15, 2)  NOT NULL,
    PCDACTAMOUNT DECIMAL (15, 2)  NOT NULL,
    PCDEXP DECIMAL (15, 2)  NOT NULL,
    PCDINIBAL DECIMAL (15, 2)  NOT NULL,
    PCDCHGAMT DECIMAL (15, 2)  NOT NULL,
    PCDENDBAL DECIMAL (15, 2)  NOT NULL,
    PCDALLINIBAL DECIMAL (15, 2)  NOT NULL,
    PCDALLENDBAL DECIMAL (15, 2)  NOT NULL,
    PCDPRODUCT DECIMAL (15, 2)  NOT NULL,
    PCDRATE DECIMAL (9, 4)  NOT NULL
);

ALTER TABLE FDWPCD ADD
    CONSTRAINT PK_FDWPCD PRIMARY KEY
    (
        PCDPCCID,
        PCDPACID
    );

/******************************************
FDWPDH   保修金结息记录历史明细表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPDH]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPDH];
CREATE TABLE [dbo].[FDWPDH] (
    PDHPCCID VARCHAR (32)  NOT NULL,
    PDHPACID VARCHAR (32)  NOT NULL,
    PDHPCTMBDTYPE VARCHAR (32)  NOT NULL,
    PDHAMOUNT DECIMAL (15, 2)  NOT NULL,
    PDHACTAMOUNT DECIMAL (15, 2)  NOT NULL,
    PDHEXP DECIMAL (15, 2)  NOT NULL,
    PDHINIBAL DECIMAL (15, 2)  NOT NULL,
    PDHCHGAMT DECIMAL (15, 2)  NOT NULL,
    PDHENDBAL DECIMAL (15, 2)  NOT NULL,
    PDHALLINIBAL DECIMAL (15, 2)  NOT NULL,
    PDHALLENDBAL DECIMAL (15, 2)  NOT NULL,
    PDHPRODUCT DECIMAL (15, 2)  NOT NULL,
    PDHRATE DECIMAL (9, 4)  NOT NULL
);

ALTER TABLE FDWPDH ADD
    CONSTRAINT PK_FDWPDH PRIMARY KEY
    (
        PDHPCCID,
        PDHPACID
    );

/******************************************
FDWSBA   专户账户表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSBA]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSBA];
CREATE TABLE [dbo].[FDWSBA] (
    SBAID VARCHAR (32)  NOT NULL,
    SBAMBDTYPE VARCHAR (20)  NOT NULL,
    SBAMBDID VARCHAR (32)  NOT NULL,
    SBABNKID VARCHAR (32)  NOT NULL,
    SBADEPNUM VARCHAR (100)  NOT NULL,
    SBADEPBNK VARCHAR (100)  NOT NULL,
    SBABNKNO VARCHAR (100)  NOT NULL,
    SBABNKPER VARCHAR (100)  NOT NULL,
    SBAHOOKDATE VARCHAR (8)  NOT NULL,
    SBAPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    SBASTATUS VARCHAR (1)  NOT NULL,
    SBADATASTATUS VARCHAR (1)  NOT NULL,
    SBARENDATE VARCHAR (8)  NOT NULL,
    SBARENTIME VARCHAR (6)  NOT NULL,
    SBABINDDATE VARCHAR (8)  NOT NULL,
    SBABINDTIME VARCHAR (6)  NOT NULL,
    SBADESC VARCHAR (1024)  NOT NULL
);

ALTER TABLE FDWSBA ADD
    CONSTRAINT PK_FDWSBA PRIMARY KEY
    (
        SBAID
    );

/******************************************
FDWSBL   专户流水表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSBL]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSBL];
CREATE TABLE [dbo].[FDWSBL] (
    SBLID VARCHAR (32)  NOT NULL,
    SBLSBAID VARCHAR (32)  NOT NULL,
    SBLDATE VARCHAR (8)  NOT NULL,
    SBLTIME VARCHAR (6)  NOT NULL,
    SBLAMOUNT DECIMAL (15, 2)  NOT NULL,
    SBLSTATUS VARCHAR (1)  NOT NULL,
    SBLBUSDESC VARCHAR (50)  NOT NULL,
    SBLBNKBUSTYPE VARCHAR (200)  NOT NULL,
    SBLBNKID VARCHAR (32)  NOT NULL,
    SBLBNKACLID VARCHAR (50)  NOT NULL
);

ALTER TABLE FDWSBL ADD
    CONSTRAINT PK_FDWSBL PRIMARY KEY
    (
        SBLID
    );

/******************************************
FDWSBC   专户更名记录表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSBC]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSBC];
CREATE TABLE [dbo].[FDWSBC] (
    SBCID VARCHAR (32)  NOT NULL,
    SBCSBAID VARCHAR (32)  NOT NULL,
    SBCOLDNAME VARCHAR (100)  NOT NULL,
    SBCNEWNAME VARCHAR (100)  NOT NULL,
    SBCSTATUS VARCHAR (1)  NOT NULL,
    SBCLAUDATE VARCHAR (8)  NOT NULL,
    SBCLAUTIME VARCHAR (6)  NOT NULL,
    SBCYHSUSER VARCHAR (50)  NOT NULL,
    SBCYHSCOMPANY VARCHAR (100)  NOT NULL,
    SBCDATE VARCHAR (8)  NOT NULL,
    SBCTIME VARCHAR (6)  NOT NULL,
    SBCDESC VARCHAR (1024)  NOT NULL
);

ALTER TABLE FDWSBC ADD
    CONSTRAINT PK_FDWSBC PRIMARY KEY
    (
        SBCID
    );

/******************************************
FDWTRA   专户转账表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWTRA]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWTRA];
CREATE TABLE [dbo].[FDWTRA] (
    TRAID VARCHAR (32)  NOT NULL,
    TRAORIMBDTYPE VARCHAR (32)  NOT NULL,
    TRAORIMBDID VARCHAR (32)  NOT NULL,
    TRAOUTMBDTYPE VARCHAR (20)  NOT NULL,
    TRAOUTMBDID VARCHAR (32)  NOT NULL,
    TRAINMBDTYPE VARCHAR (20)  NOT NULL,
    TRAINMBDID VARCHAR (32)  NOT NULL,
    TRABNKID VARCHAR (32)  NOT NULL,
    TRAOUTDEPNUM VARCHAR (100)  NOT NULL,
    TRAOUTDEPBNK VARCHAR (100)  NOT NULL,
    TRAOUTBNKNO VARCHAR (100)  NOT NULL,
    TRAOUTBNKPER VARCHAR (100)  NOT NULL,
    TRAINDEPNUM VARCHAR (100)  NOT NULL,
    TRAINDEPBNK VARCHAR (100)  NOT NULL,
    TRAINBNKNO VARCHAR (100)  NOT NULL,
    TRAINBNKPER VARCHAR (100)  NOT NULL,
    TRAAMOUNT DECIMAL (15, 2)  NOT NULL,
    TRASTATUS VARCHAR (1)  NOT NULL,
    TRADATASTATUS VARCHAR (1)  NOT NULL,
    TRALAUDATE VARCHAR (8)  NOT NULL,
    TRALAUTIME VARCHAR (6)  NOT NULL,
    TRAOUTDATE VARCHAR (8)  NOT NULL,
    TRAOUTTIME VARCHAR (6)  NOT NULL,
    TRAACCDATE VARCHAR (8)  NOT NULL,
    TRAACCTIME VARCHAR (6)  NOT NULL,
    TRAHOOKDATE VARCHAR (8)  NOT NULL,
    TRAHOOKTIME VARCHAR (6)  NOT NULL,
    TRAYHSUSER VARCHAR (50)  NOT NULL,
    TRAYHSCOMPANY VARCHAR (100)  NOT NULL,
    TRAYHSDATE VARCHAR (8)  NOT NULL,
    TRAYHSTIME VARCHAR (6)  NOT NULL,
    TRAYHSCOMMENT VARCHAR (2000)  NOT NULL,
    TRABUSIFLOW VARCHAR (1)  NOT NULL,
    TRADESC VARCHAR (1024)  NOT NULL,
    TRAFLOW VARCHAR (20)  NOT NULL
);

ALTER TABLE FDWTRA ADD
    CONSTRAINT PK_FDWTRA PRIMARY KEY
    (
        TRAID
    );

/******************************************
FDWTSR   专户转账关联小区表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWTSR]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWTSR];
CREATE TABLE [dbo].[FDWTSR] (
    TSRID VARCHAR (32)  NOT NULL,
    TSRTRAID VARCHAR (32)  NOT NULL,
    TSRSRQID VARCHAR (32)  NOT NULL,
    TSRKIND VARCHAR (10)  NOT NULL,
    TSRPRINCIPAL DECIMAL (15, 2)  NOT NULL,
    TSRACCRUAL DECIMAL (15, 2)  NOT NULL
);

ALTER TABLE FDWTSR ADD
    CONSTRAINT PK_FDWTSR PRIMARY KEY
    (
        TSRID
    );

/******************************************
FDWSAM   专户同名账户表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSAM]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSAM];
CREATE TABLE [dbo].[FDWSAM] (
    SAMID VARCHAR (32)  NOT NULL,
    SAMSBAID VARCHAR (32)  NOT NULL,
    SAMMBDTYPE VARCHAR (20)  NOT NULL,
    SAMMBDID VARCHAR (32)  NOT NULL,
    SAMDEPBNK VARCHAR (100)  NOT NULL,
    SAMBNKNO VARCHAR (100)  NOT NULL,
    SAMBNKPER VARCHAR (100)  NOT NULL,
    SAMSTATUS VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWSAM ADD
    CONSTRAINT PK_FDWSAM PRIMARY KEY
    (
        SAMID
    );

/******************************************
FDWSAR   小区资金专户所属描述表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSAR]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSAR];
CREATE TABLE [dbo].[FDWSAR] (
    SARID VARCHAR (32)  NOT NULL,
    SARSRQID VARCHAR (32)  NOT NULL,
    SARATKKIND VARCHAR (32)  NOT NULL,
    SARSPACTMBDTYPE VARCHAR (50)  NOT NULL,
    SARSPACTMBDID VARCHAR (32)  NOT NULL,
    SARBUSISTATUS VARCHAR (1)  NOT NULL,
    SARISACCING VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWSAR ADD
    CONSTRAINT PK_FDWSAR PRIMARY KEY
    (
        SARID
    );

/******************************************
FDWOTA   一次性授权业务表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWOTA]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWOTA];
CREATE TABLE [dbo].[FDWOTA] (
    OTAID VARCHAR (32)  NOT NULL,
    OTASRQID VARCHAR (32)  NOT NULL,
    OTAATKKIND VARCHAR (32)  NOT NULL,
    OTAYEAR VARCHAR (4)  NOT NULL,
    OTAMONEY DECIMAL (15, 2)  NOT NULL,
    OTASTATUS VARCHAR (1)  NOT NULL,
    OTABASIS VARCHAR (2000)  NOT NULL,
    OTAREMARK VARCHAR (200)  NOT NULL,
    OTAYHSUSER VARCHAR (50)  NOT NULL,
    OTAYHSCOMPANY VARCHAR (100)  NOT NULL,
    OTAYHSDATE VARCHAR (8)  NOT NULL,
    OTAYHSTIME VARCHAR (6)  NOT NULL,
    OTAYHSCOMMENT VARCHAR (2000)  NOT NULL
);

ALTER TABLE FDWOTA ADD
    CONSTRAINT PK_FDWOTA PRIMARY KEY
    (
        OTAID
    );

/******************************************
FDWOTL   一次性授权余额表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWOTL]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWOTL];
CREATE TABLE [dbo].[FDWOTL] (
    OTLID VARCHAR (32)  NOT NULL,
    OTLSRQID VARCHAR (32)  NOT NULL,
    OTLATKKIND VARCHAR (32)  NOT NULL,
    OTLYEAR VARCHAR (4)  NOT NULL,
    OTLMONEYTOT DECIMAL (15, 2)  NOT NULL,
    OTLBALANCE DECIMAL (15, 2)  NOT NULL
);

ALTER TABLE FDWOTL ADD
    CONSTRAINT PK_FDWOTL PRIMARY KEY
    (
        OTLID
    );

/******************************************
FDWSUP   监管权信息表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSUP]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSUP];
CREATE TABLE [dbo].[FDWSUP] (
    SUPID VARCHAR (32)  NOT NULL,
    SUPMBDTYPE VARCHAR (50)  NOT NULL,
    SUPMBDID VARCHAR (32)  NOT NULL,
    SUPSRQID VARCHAR (32)  NOT NULL,
    SUPATKKIND VARCHAR (32)  NOT NULL,
    SUPDATE VARCHAR (8)  NOT NULL,
    SUPTIME VARCHAR (6)  NOT NULL,
    SUPSTATUS VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWSUP ADD
    CONSTRAINT PK_FDWSUP PRIMARY KEY
    (
        SUPID
    );

/******************************************
FDWPAA   维修资金缴款申请表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWPAA]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWPAA];
CREATE TABLE [dbo].[FDWPAA] (
    PAAID VARCHAR (32)  NOT NULL,
    PAANO VARCHAR (32)  NOT NULL,
    PAAMBDNAME VARCHAR (200)  NOT NULL,
    PAAORIMBDTYPE VARCHAR (32)  NOT NULL,
    PAAORIMBDID VARCHAR (32)  NOT NULL,
    PAADECLARATION VARCHAR (1)  NOT NULL,
    PAALICENSE VARCHAR (50)  NOT NULL,
    PAABDRID VARCHAR (32)  NOT NULL,
    PAABDRNAME VARCHAR (100)  NOT NULL,
    PAABDRBIZCODE VARCHAR (50)  NOT NULL,
    PAAHOLDNAME VARCHAR (100)  NOT NULL,
    PAALICDYSTATUS VARCHAR (50)  NOT NULL,
    PAALICHSSTATUS VARCHAR (50)  NOT NULL,
    PAADTRID VARCHAR (32)  NOT NULL,
    PAAAPPPSN VARCHAR (20)  NOT NULL,
    PAAAPPLINKPHONE VARCHAR (50)  NOT NULL,
    PAAAPPLINKPERID VARCHAR (50)  NOT NULL,
    PAADECLAREAREA DECIMAL (15, 4)  NOT NULL,
    PAAMONEY DECIMAL (15, 2)  NOT NULL,
    PAARECEIVEEMAIL VARCHAR (100)  NOT NULL,
    PAAINVOICE VARCHAR (50)  NOT NULL,
    PAAADDRESSEE VARCHAR (20)  NOT NULL,
    PAAADDTEL VARCHAR (50)  NOT NULL,
    PAAADDUNIT VARCHAR (100)  NOT NULL,
    PAAADDRESS VARCHAR (100)  NOT NULL,
    PAAACCEPTDATE VARCHAR (8)  NOT NULL,
    PAATAKEDATE VARCHAR (8)  NOT NULL,
    PAASTATUS VARCHAR (1)  NOT NULL,
    PAAREMARKS VARCHAR (200)  NOT NULL,
    PAAYHSUSER VARCHAR (50)  NOT NULL,
    PAAYHSCOMPANY VARCHAR (100)  NOT NULL,
    PAAYHSDATE VARCHAR (8)  NOT NULL,
    PAAYHSTIME VARCHAR (6)  NOT NULL,
    PAAYHSCOMMENT VARCHAR (2000)  NOT NULL,
    PAADATASTATUS VARCHAR (1)  NOT NULL,
    PAAFLOW VARCHAR (20)  NOT NULL,
    PAAAMAREMARKS VARCHAR (200)  NOT NULL,
    PAAPAYID VARCHAR (32)  NOT NULL,
    PAALICENSENUM VARCHAR (50)  NOT NULL,
    PAAOPNUM VARCHAR (50)  NOT NULL,
    PAAYHSPAUSEDATE VARCHAR (8)  NOT NULL
);

ALTER TABLE FDWPAA ADD
    CONSTRAINT PK_FDWPAA PRIMARY KEY
    (
        PAAID
    );

/******************************************
FDWAMA   受理材料情况表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWAMA]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWAMA];
CREATE TABLE [dbo].[FDWAMA] (
    AMAID VARCHAR (32)  NOT NULL,
    AMAMBDID VARCHAR (32)  NOT NULL,
    AMASUBMBDID VARCHAR (32)  NOT NULL,
    AMANAME VARCHAR (128)  NOT NULL,
    AMAISMUST VARCHAR (1)  NOT NULL,
    AMADESC VARCHAR (256)  NOT NULL,
    AMAMANNUM INT  NOT NULL,
    AMAMANFACTNUM INT  NOT NULL,
    AMAREMARKS VARCHAR (200)  NOT NULL
);

ALTER TABLE FDWAMA ADD
    CONSTRAINT PK_FDWAMA PRIMARY KEY
    (
        AMAID
    );

/******************************************
FDWSPR   单一产权项目表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSPR]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSPR];
CREATE TABLE [dbo].[FDWSPR] (
    SPRID VARCHAR (32)  NOT NULL,
    SPRNO VARCHAR (32)  NOT NULL,
    SPRMBDNAME VARCHAR (200)  NOT NULL,
    SPRORIMBDTYPE VARCHAR (32)  NOT NULL,
    SPRORIMBDID VARCHAR (32)  NOT NULL,
    SPRDECLARATION VARCHAR (1)  NOT NULL,
    SPRLICENSE VARCHAR (50)  NOT NULL,
    SPRBDRID VARCHAR (32)  NOT NULL,
    SPRBDRNAME VARCHAR (100)  NOT NULL,
    SPRBDRBIZCODE VARCHAR (50)  NOT NULL,
    SPRLICDYSTATUS VARCHAR (50)  NOT NULL,
    SPRDTRID VARCHAR (32)  NOT NULL,
    SPRLICENSENUM VARCHAR (50)  NOT NULL,
    SPRBELOCATED VARCHAR (100)  NOT NULL,
    SPRCONTRACTNO VARCHAR (50)  NOT NULL,
    SPRPURPOSE VARCHAR (50)  NOT NULL,
    SPRAPPPSN VARCHAR (20)  NOT NULL,
    SPRAPPLINKPHONE VARCHAR (50)  NOT NULL,
    SPRAPPLINKPERID VARCHAR (50)  NOT NULL,
    SPRAREA DECIMAL (15, 4)  NOT NULL,
    SPRLETTER VARCHAR (50)  NOT NULL,
    SPRCONDITION VARCHAR (100)  NOT NULL,
    SPRADDRESSEE VARCHAR (20)  NOT NULL,
    SPRADDTEL VARCHAR (50)  NOT NULL,
    SPRADDUNIT VARCHAR (100)  NOT NULL,
    SPRADDRESS VARCHAR (100)  NOT NULL,
    SPRACCEPTDATE VARCHAR (8)  NOT NULL,
    SPRTAKEDATE VARCHAR (8)  NOT NULL,
    SPRCHECKDATE VARCHAR (8)  NOT NULL,
    SPRCHECKNUM VARCHAR (32)  NOT NULL,
    SPRSTATUS VARCHAR (1)  NOT NULL,
    SPRREMARKS VARCHAR (200)  NOT NULL,
    SPRYHSUSER VARCHAR (50)  NOT NULL,
    SPRYHSCOMPANY VARCHAR (100)  NOT NULL,
    SPRYHSDATE VARCHAR (8)  NOT NULL,
    SPRYHSTIME VARCHAR (6)  NOT NULL,
    SPRYHSCOMMENT VARCHAR (2000)  NOT NULL,
    SPRDATASTATUS VARCHAR (1)  NOT NULL,
    SPRFLOW VARCHAR (20)  NOT NULL,
    SPRAMAREMARKS VARCHAR (200)  NOT NULL,
    SPRYHSPAUSEDATE VARCHAR (8)  NOT NULL
);

ALTER TABLE FDWSPR ADD
    CONSTRAINT PK_FDWSPR PRIMARY KEY
    (
        SPRID
    );

/******************************************
FDWWIL   通配符表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWWIL]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWWIL];
CREATE TABLE [dbo].[FDWWIL] (
    WILMBDID VARCHAR (32)  NOT NULL,
    WILNAME VARCHAR (32)  NOT NULL,
    WILDESC VARCHAR (50)  NOT NULL
);

ALTER TABLE FDWWIL ADD
    CONSTRAINT PK_FDWWIL PRIMARY KEY
    (
        WILMBDID,
        WILNAME
    );

/******************************************
FDWSMC   短信配置表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSMC]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSMC];
CREATE TABLE [dbo].[FDWSMC] (
    SMCID VARCHAR (32)  NOT NULL,
    SMCFIELD VARCHAR (50)  NOT NULL,
    SMCSIGN VARCHAR (1)  NOT NULL,
    SMCFROMSTATUS VARCHAR (26)  NOT NULL,
    SMCTOSTATUS VARCHAR (26)  NOT NULL,
    SMCNAME VARCHAR (100)  NOT NULL,
    SMCSTATUS VARCHAR (1)  NOT NULL,
    SMCCHECK VARCHAR (1)  NOT NULL
);

ALTER TABLE FDWSMC ADD
    CONSTRAINT PK_FDWSMC PRIMARY KEY
    (
        SMCID
    );

/******************************************
FDWSMM   短信模版表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSMM]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSMM];
CREATE TABLE [dbo].[FDWSMM] (
    SMMID VARCHAR (32)  NOT NULL,
    SMMSMCID VARCHAR (32)  NOT NULL,
    SMMCONTENT VARCHAR (500)  NOT NULL,
    SMMNUM DECIMAL (15, 2)  NOT NULL
);

ALTER TABLE FDWSMM ADD
    CONSTRAINT PK_FDWSMM PRIMARY KEY
    (
        SMMID
    );

/******************************************
FDWSMS   短信发送表
******************************************/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FDWSMS]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    DROP TABLE [dbo].[FDWSMS];
CREATE TABLE [dbo].[FDWSMS] (
    SMSID VARCHAR (32)  NOT NULL,
    SMSSMCID VARCHAR (32)  NOT NULL,
    SMSMBDID VARCHAR (32)  NOT NULL,
    SMSMBDNO VARCHAR (32)  NOT NULL,
    SMSCOMTYPE VARCHAR (32)  NOT NULL,
    SMSCOMNUM VARCHAR (32)  NOT NULL,
    SMSCOMNAME VARCHAR (100)  NOT NULL,
    SMSMONEY DECIMAL (15, 2)  NOT NULL,
    SMSRECEIVEPHONE VARCHAR (50)  NOT NULL,
    SMSRECEIVENAME VARCHAR (50)  NOT NULL,
    SMSTYPE VARCHAR (1)  NOT NULL,
    SMSCONTENT VARCHAR (500)  NOT NULL,
    SMSSTATUS VARCHAR (1)  NOT NULL,
    SMSSENDSTATUS VARCHAR (1)  NOT NULL,
    SMSSENDDESC VARCHAR (300)  NOT NULL,
    SMSCREATEUSR VARCHAR (50)  NOT NULL,
    SMSCREATEDATE VARCHAR (8)  NOT NULL,
    SMSCREATETIME VARCHAR (6)  NOT NULL,
    SMSSENDDATE VARCHAR (8)  NOT NULL,
    SMSSENDTIME VARCHAR (6)  NOT NULL
);

ALTER TABLE FDWSMS ADD
    CONSTRAINT PK_FDWSMS PRIMARY KEY
    (
        SMSID
    );


